Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| // <Snippet6> | |
| using System; | |
| using System.Text.RegularExpressions; | |
| public class Example | |
| { | |
| public static void Main() | |
| { | |
| string pattern = @"\b(\w+)\s\1\b"; | |
| string substitution = "$+"; | |
| string input = "The the dog jumped over the fence fence."; | |
| Console.WriteLine(Regex.Replace(input, pattern, substitution, | |
| RegexOptions.IgnoreCase)); | |
| } | |
| } | |
| // The example displays the following output: | |
| // The dog jumped over the fence. | |
| // </Snippet6> |