using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\b\d{12}\b.+?(?=\b\d{12}\b|$)";
string input = @"LOREM IPSUM LOR IPSUM DDDDDDDDD FG SSSSS NUMBER 106/03/2019 LOREMFG OF LOREMIPSUMF LOREM OPFRTE ERTIO LOREMIPS LOREMIOS 05/30/2019 DERTE TH LOREM (LWA LTD)------------------------------------------------------------------------------------------------------------------------------------011111111111 CDGH, LGF ADF : 203 HYT *LOREM IPSUM / LOREM IPSUM* COUNTY : GTYH CHIDGER L. IPSUM THJ. DATE: 07/21/2000 LOREM IPSUM DOLOT & LOREM IPSUM 768 LOREM IPSUM, 67TH LOREM IPSUM IPSUM. DTEA: NIGER, GA 12345 LOREM IPSUM DOLOT 97 LOREM IPSUM DOLOT, KY 35678-8765 011111111111 CDGH, LGF ADF : 203 HYT *LOREM IPSUM / LOREM IPSUM* COUNTY : GTYH CHIDGER L. IPSUM THJ. DATE: 07/21/2000 LOREM IPSUM DOLOT & LOREM IPSUM 768 LOREM IPSUM, 67TH LOREM IPSUM IPSUM. DTEA: NIGER, GA 12345 LOREM IPSUM DOLOT 97 LOREM IPSUM DOLOT, KY 35678-8765 011111111111 CDGH, LGF ADF : 203 HYT *LOREM IPSUM / LOREM IPSUM* COUNTY : GTYH CHIDGER L. IPSUM THJ. DATE: 07/21/2000 LOREM IPSUM DOLOT & LOREM IPSUM 768 LOREM IPSUM, 67TH LOREM IPSUM IPSUM. DTEA: NIGER, GA 12345 LOREM IPSUM DOLOT 97 LOREM IPSUM DOLOT, KY 35678-8765 ";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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