Reputation: 1402
I nedd the check whether the word ends with one of the _LNG , _DBL , _STR . My regex is
"_[(LNG|DBL|STR)]$"
but does work . Following must match but did'nt work. (I use java)
PARAM_LNG
I have tried following
"[(_LNG|_DBL|_STR)]$"
but it matchs with following although it has no underscore.
PARAMLNG
Can anyone show the right regex? Thanks.
Upvotes: 1
Views: 51
Reputation: 206679
Don't use []
, that's a character class specification.
"_(LNG|DBL|STR)$"
Note that this will only match at the end of the string. Try:
"_(LNG|DBL|STR)\b"
to match any word ending with those suffixes inside a string.
Upvotes: 5