case sensitivity when matching strings

manared

Well-known member
Joined
Jun 1, 2006
Messages
84
Programming Experience
1-3
This is very similar to my last question. I have some code that goes through a string and sees if another string mathces that one. This is my code right now:
VB.NET:
If System.Text.RegularExpressions.Regex.Matches(SMS, "\b" & campaign & "\b").Count > 0 Then
End if
There is one small problem though. If SMS = "Pitrow" and campaign = "pitrow", I need them to match. Right now they do not because SMS has a captial letter in it. How do I make the statement so it is NON case sensitive? These two words should match and they are not right now!!
Thanks!!!
 
Regex.Matches method is overloaded, meaning the same method allows for different input parameters. Use the one where you can also set RegexOptions:
VB.NET:
...Regex.Matches(String, String, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
 
Back
Top