using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<!\S)(?:[1-9]\d\d?,\d{3}|(?:[1-9]\d?|1[0-4]\d),\d{3},\d{3}|150,000,000)(?!\S)";
string input = @"10,000
10,001
10,100
100,000
999,999
149,999,999
150,000,000
55,555
99,999
73,129
834,101
1,333,333
149,000,000
20,111,000
99,001,000
10,001,000
10,999,999
2,999,999
950,000
999,999
910,000
949,999
950,000
949,999,999
1,999,999,999
100,949,999,999
1
1,0
9,000
9,999
5,555
250,000,000
9,999
100000
150,000,001
150,000,100
150,001,000
150,100,000
151,000,000
9,150,000,000
160,000,000
000,000,000
";
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