using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?'group1'[\d])";
string substitution = @"$1 & ";
string input = @"101011010
110101101
111010110
111101011
011110101
101111010
110111101
011011110
001101111
100110111
110011011
111001101
111100110
011110011
001111001
100111100
010011110
001001111
100100111
010010011
001001001
000100100
000010010
000001001
000000100
000000010
100000001";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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