using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(^\-?0[\,\.][0-9]{1,}$)|(^\-?[1-9][0-9]{1,}$)|(^[0-9]$)|(^\-?[1-9][0-9]{0,}[\,\.][0-9]{1,}$)|(^\-?[1-9]$)";
string input = @"01
001
033
0000033
00000.2
00000000000000
01010101010
0000.0
aaa
???!!!!!
111%$$$$
-0
-
-100
-100.255
-10.25555
-1.2
-1335354.12
-22
-2
-1
-13353544366564547
-0.22222298
-0.2
-0,2989080
-6767676767676767677676767677676
-0.22
-123
-1
100.255
10.25555
1.2
1335354.12
22
2
1
13353544366564547
0.22222298
0.2
0,2989080
6767676767676767677676767677676
0
0.22
123";
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