Reputation: 1015
I want to check the string contains ST=
. there may be spaces before/after ST
and =
.
so i have regex match as "\\s*ST\\s*=\\w+"
, but it doesn't work. Any thoughts?
String REG_MATCH = "\\s*ST\\s*=\\w+";
String value =" ST= CA"
if (value.matches(REG_MATCH)){
--matched
}
Thanks in advance.
Upvotes: 1
Views: 259
Reputation: 785156
Include optional space before and after =
:
String REG_MATCH = "\\s*ST\\s*=\\s*\\w+";
Upvotes: 1