using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^([r])([1-9A-HJ-NP-Za-km-z]{24,34})$";
string input = @"// valid addresses
rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn
r9kiSEUEw6iSCNksDVKf9k3AyxjW3r1qPf
rs2qdz5stxyWeMk6sNz5mLY6h5xxPYNJ8u
rfe8yiZUymRPx35BEwGjhfkaLmgNsTytxT
rPE9dw1gR8ravY2o25zudXmj2L28UTNt4D
r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X
// invalid addresses (with O, I, l or 0)
rPE9dw1gR8ravY2o25zudXmj2L20UTNt4D
r9vbV3EHvXWjSkeQ6CAcYVPGel7TuiXY2X
r9vbV3EHvXWjSkeQ6CAcYVPGeqOTuiXY2X
r9vbV3EHvXWjSkeQ6CAcYVPGeqITuiXY2X
";
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