Reputation: 1647
I am trying to find camel case element from a string,
ex : iOS
Below is what is trying :
token.matches("(a-z)+(//W)")
but it is not picking up camel case words.
Help will be appreciated thanks
Upvotes: 1
Views: 209
Reputation: 71538
Use the regex:
"[a-z]+[A-Z]+"
(a-z)+
matches literal a-z
one or more times and (//W)
matches literal //W
one time.
Square brackets are used for character ranges, not parentheses.
And if you meant \\W
, this is equivalent to [^\\w]
, meaning "not word characters". It will be matching stuff like punctuation and spaces.
Upvotes: 2