1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | using System; using System.Text.RegularExpressions; namespace RegexTest { public class RegexTest { static void Main() { string lText = "Kevin David Mitnick is a computer " + "security consultant and author. In" + " the late 20th century, he was " + "convicted of various computer- and" + " communications-related crimes. At" + " the time of his arrest, he was " + "the most-wanted computer criminal " + "in the United States"; Console.WriteLine("Original string : " + lText + "\n"); lText = Regex.Replace(lText, @"\s+computer", " Nintendo Wii"); Console.WriteLine("Processed string : " + lText); } } } |