Mega Code Archive

 
Categories / C# Tutorial / Regular Expression
 

W+ Match one or more word characters

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);    } }