RayT
asked on
Case-Insensitive Search
How do I make the following work? I want match.Success to be True regardless of the case. If the testString = "AAA" or testString = "aAa"
dim testString as string = "AAa"
Dim match As Match = Regex.Match(testString , "([\s\S])\1\1")
dim testString as string = "AAa"
Dim match As Match = Regex.Match(testString , "([\s\S])\1\1")
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Why is the regex completely wrong? Are you saying this is not valid? I thought \s\S is the same as .
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes. That's what I am trying to do.
ASKER
Sorry, how do I modify the following to do just that?
Dim match As Match = Regex.Match(testString , "(.)\1\1")
Dim match As Match = Regex.Match(testString , "(.)\1\1")
ASKER
I solve my problem with the following solution:
Dim match As Match = Regex.Match(testString.ToL ower() , "(.)\1\1")
Dim match As Match = Regex.Match(testString.ToL
Dim match As Match = Regex.Match(testString, "(?i)(.)\1\1")
should do also.
should do also.
ASKER
Thanks! It does indeed.
Why not?
(?i)
refer to
http://www.regular-expressions.info/modifiers.html
Regards