S
Sharp
Hi
I have a string, for example:
String str = "aaab";
I would like to use the matches() method of the String class to test the
string's first 3 characters are identical.
I would like to do this in a general way by using regular expressions.
Tried (but doesn't work):
if (str.matches("xxx[a-zA-Z]"))
return true;
According to the regular expression, x is suppose to be a character.
Not sure, why this is not working, or if it's even possible to do it using
the matches method.
Any help appreciated.
Cheers
Sharp
I have a string, for example:
String str = "aaab";
I would like to use the matches() method of the String class to test the
string's first 3 characters are identical.
I would like to do this in a general way by using regular expressions.
Tried (but doesn't work):
if (str.matches("xxx[a-zA-Z]"))
return true;
According to the regular expression, x is suppose to be a character.
Not sure, why this is not working, or if it's even possible to do it using
the matches method.
Any help appreciated.
Cheers
Sharp