using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\()|(?:(([udfblrmesxyz])(?:([-i'])|(2))?)|(\[((?:(?:[ud][fb]|[fb][ud])(?:[lr]?)|(?:[fb][lr]|[lr][fb])(?:[ud]?)|(?:[ud][lr]|[lr][ud])(?:[fb]?))|(?:o[24][udfb]|o6[lr]|c[cw][23]|pt[jn]|par|prn))]))|(\)([1-9min'])?)";
string input = @"face rotations: fblrudf'b'l'r'u'd'fibiliriuidi
axis rotations: xyzx'y'z'xiyizi
pieces: [uf][ub][df][db][fu][bu][fd][bd][fl][fr][bl][br][lf][rf][lb][rb][ur][ul][dr][dl][ru][lu][rd][ld][urf][ufr]...
patterns: [o2u][o2f]...[o4d][o4b]...[o6l][o6r][cc2][cc3][cw2][cw3][par][ptn][ptj][prn]
groups: (rf) (rf)'(rf)n (rf)i (rf)m (rf)3
mixed (and test):
[f'r-abix2]
[r2u]
(r(fr)i[FR])m f";
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