using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(NUMBER[(](\d{1,3},\d)[)])|(NUMBER[(]((\d{1,3})|(\d{1,3}[,]\d))[)]((?=\/DECIMAL)|(?=\/PERCENTAGE)).*)";
string input = @"NUMBER(12)
NUMBER(12)/NUMBER
NUMBER(1)
NUMBER(1)/NUMBER
(100)
DATATYPE=NUMBER
NUMBER
NUMBER()
NUMBER(10,2)/PERCENTAGE
NUMBER(12)/DECIMAL
NUMBER(12,4)
NUMBER(13,4)
NUMBER(15)/DECIMAL
NUMBER(15,2)
NUMBER(16)/DECIMAL
NUMBER(10,3)/DECIMAL
NUMBER(3)/DECIMAL
NUMBER(3)/PERCENTAGE
NUMBER(4)/DECIMAL
NUMBER(4,1)
NUMBER(4,2)
NUMBER(5)/DECIMAL
NUMBER(5)/PERCENTAGE
NUMBER(5,2)
NUMBER(5,2)/PERCENTAGE
NUMBER(6)/DECIMAL
NUMBER(7)/DECIMAL
NUMBER(8)/DECIMAL
NUMBER/
NUMBER/CURRENCY
NUMBER/DECIMAL
NUMBER/IFS CURRENCY
NUMBER/INVISIBLE
NUMBER/NUMBER
NUMBER/PERCENTAGE
NUMBER/UPPERCASE
NUMBER=
Number
number
";
RegexOptions options = RegexOptions.IgnoreCase;
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