Capitalization
using System.Text.RegularExpressions; public class MyClass { public static void Main() { string text = "the quick red fox jumped over the lazy brown DOG."; System.Console.WriteLine("text=[" + text + "]"); string result = Regex.Replace(text, @"\w+", new MatchEvaluator(MyClass.CapText)); System.Console.WriteLine("result=[" + result + "]"); System.Console.ReadLine(); } static string CapText(Match m) { string temp = m.ToString(); temp = char.ToUpper(temp[0]) + temp.Substring(1, temp.Length - 1).ToLower(); return temp; } }
http://windows.oreilly.com/news/csharp_0101.html