Tuesday, April 21, 2015

remove return consecutive word by REGEX


string pattern = @"\b(\w+)\s\1\b";
            string substitution = "$+";
            string input = "The the dog dog jumped jumped over the fence fence.";
            MessageBox.Show(Regex.Replace(input, pattern, substitution,
                              RegexOptions.IgnoreCase));

https://msdn.microsoft.com/en-us/library/ewy2t5e0(v=vs.110).aspx

No comments:

Post a Comment