re = /(\()|(?:(([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'])?)/i
str = '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'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html