using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^0x[0-9a-f]+$";
string input = @"3
999
-3
0
0.0
1.0
0.1
.01
-0.0000000000000000000000000000000001
2e3
-2e3
2e-3
-2e-3
1.0e0
0.1e1
.01e-1
-9.1e3
-9.1e-3
9E5
0e-11
0xff
0XFF
0x0
0xfe3
0e0
.0e-0
.0e5
.0e-5
0.0e0
0.0e123
0.0e-123
-0
-0.0
-0.0000000000000000000000000000000000
-.0
-.0000000000000000000000000000000000
1xff
0x
0x0fg3
0xf4.
.0xf
0xfe-3
-0xff
0.0xff
0xff.1
1e-
e89
.e3
001
-00.2
6.
f
-1
--1
-.1
2-
.-1";
RegexOptions options = RegexOptions.Multiline | 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