CSharp examples for Language Basics:Regex
replace every word with "word" and display the result
using System;// w w w. j av a2 s . co m using System.Text.RegularExpressions; class MainClass { static void Main(string[] args) { string testString = "1, 2, 3, 4, 5, 6, 7, 8"; // replace every word with "word" and display the result Console.WriteLine("Every word replaced by \"word\": {0}", Regex.Replace(testString, @"\w+", "word")); } }