I'm running some code through the eclipse debugger and a[1].matches("[a-zA-Z]")
is not equating to true
when a[1] = "ABCD"
(a
is a string array).
I've read the javadoc on matches
and [a-zA-Z]
should be a valid regular expression..
Anyone know where I'm going wrong?
Try using this expression: [a-zA-Z]*
(will match zero or more characters).
If you require at least one character, use: [a-zA-Z]+
The expression you're using will only match a single alpha character since it's not quantified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With