Mega Code Archive

 
Categories / C# Tutorial / Regular Expression
 

[^o] Match any character that is not an o

using System; using System.Text.RegularExpressions; public class Example {    public static void Main()    {       string pattern = @"\bth[^o]\w+\b";       string input = "this is a test";       foreach (Match match in Regex.Matches(input, pattern))          Console.WriteLine(match.Value);    } }