Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top