V VJ Sep 5, 2004 #1 I need to use RegEx to check and see if a string does not contain a set of characters, say "< > ? / $ #" How would I do this??. VJ
I need to use RegEx to check and see if a string does not contain a set of characters, say "< > ? / $ #" How would I do this??. VJ
K Ken Tucker [MVP] Sep 5, 2004 #2 Hi, Try something like this Dim rgx As New System.Text.RegularExpressions.Regex("[<>#$?/]") Trace.WriteLine(rgx.IsMatch("This is a test >")) Trace.WriteLine(rgx.IsMatch("This is another test <")) Trace.WriteLine(rgx.IsMatch("/ This is another test")) Trace.WriteLine(rgx.IsMatch("# This is another test")) Trace.WriteLine(rgx.IsMatch("This is another test ?")) Ken ------------------ I need to use RegEx to check and see if a string does not contain a set of characters, say "< > ? / $ #" How would I do this??. VJ
Hi, Try something like this Dim rgx As New System.Text.RegularExpressions.Regex("[<>#$?/]") Trace.WriteLine(rgx.IsMatch("This is a test >")) Trace.WriteLine(rgx.IsMatch("This is another test <")) Trace.WriteLine(rgx.IsMatch("/ This is another test")) Trace.WriteLine(rgx.IsMatch("# This is another test")) Trace.WriteLine(rgx.IsMatch("This is another test ?")) Ken ------------------ I need to use RegEx to check and see if a string does not contain a set of characters, say "< > ? / $ #" How would I do this??. VJ