Use regular to replace word

using System;
using System.Text.RegularExpressions;
class RegexSubstitution
{
public static void Main()
{
string testString1 = "a b c stars *****";
Regex testRegex1 = new Regex( @"\d" );
Console.WriteLine( "Original string: " + testString1 );
Console.WriteLine( "Every word replaced by \"word\": " + Regex.Replace( testString1, @"\w+", "word" ) );
}
}
Related examples in the same category