Sunday, 15 September 2013

Checking for multiple occurrence of character repeated or spread out in string with regex

Checking for multiple occurrence of character repeated or spread out in
string with regex

Having syntax trouble, I'm new to using regex. I'm coding in java.
I need to check if an apostrophe is used more than once in a string.
Multiple apostrophes can either be consecutive or spread out over the
string.
For example: Doesn't'work or Can''t
I have an if statement, and I want it to evaluate to true if there is more
than apostrophe
if(string.matches("\'")){ . . }
any help would be great!

No comments:

Post a Comment