using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\S+) \h+ (*SKIP) (?= (?>\S+\h+)*? \1 (?!\S) )";
string substitution = @"";
string input = @"Mike Tyson 1. Street 1234 Vietnam ML(12534/97632) Mike Tyson 1234 1. Street Vietnam ML(12534/97632)
Mike Tyson 2. Street 1235 Vietnam2 ML(1254/97632) Mike Tyson 1234 1. Street Vietnam ML(12534/97632)
Mike Tyson 2. Street 1235 Vietnam2 ML(1254/9762) Mike Tyson 1234 1. Street Vietnam ML(12534/97632) ";
RegexOptions options = RegexOptions.IgnorePatternWhitespace;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx