## Metacharacter tests . a y dot (.) . \n y dot (.) . '' n dot (.) a\s+f abcdef n whitespace (\s) ab\s+cdef ab cdef y whitespace (\s) a\S+f abcdef y not whitespace (\S) a\S+f ab cdef n not whitespace (\S) ^ abc abcdef y start and end of string (^) ^ abc abc\ndef y start and end of string (^) ^ abc def\nabc n start and end of string (^) def \n ^ abc def\nabc n start and end of string (^) def $ abcdef y start and end of string ($) def $ abc\ndef y start and end of string ($) def $ def\nabc n start and end of string ($) def $ \n abc def\nabc n start and end of string (^) abc \n $ abc\n y end of string ($) abc $ abc\n n end of string ($) <>def abc-def n right word boundary, beginning of word >>bc abc-def n right word boundary, mid-word c>> abc-def y right word boundary, end of word >>abc abc-def n right word boundary, BOS def>> abc-def y right word boundary, EOS >> ------- n right word boundary, no word chars c \n d abc\ndef y logical newline (\n) # todo :pugs c \n d abc\o12def y logical newline (\n) # todo :pugs c \n d abc\o15def y logical newline (\n) c \n+ d abc\n\ndef y logical newline (\n) a\n+f abcdef n logical newline (\n) c \n d abc\o12\o15def n logical newline (\n) # todo :pugs c \n d abc\o15\o12def y logical newline (\n) b \n c abc\ndef n logical newline (\n) \N a y not logical newline (\N) a \N c abc y not logical newline (\N) \N '' n not logical newline (\N) c \N d abc\ndef n not logical newline (\N) c \N d abc\o12def n not logical newline (\N) c \N d abc\o15def n not logical newline (\N) c \N+ d abc\n\ndef n not logical newline (\N) a\N+f abcdef y not logical newline (\N) c \N d abc\o12\o15def n not logical newline (\N) c \N d abc\o15\o12def n not logical newline (\N) b \N \n abc\ndef y not logical newline (\N) \Aabc Aabc /reserved/ retired metachars (\A) \Aabc abc\ndef /reserved/ retired metachars (\A) abc\Z abcZ /reserved/ retired metachars (\Z) abc\Z abc\ndef /reserved/ retired metachars (\Z) abc\z abcz /reserved/ retired metachars (\z) def\z abc\ndef /reserved/ retired metachars (\z) abc # def abc#def y comments (#) abc # xyz abc#def y comments (#) abc # def \n \$ abc#def y comments (#) abc \# def abc#def y comments (#) abc \# xyz abc#def n comments (#) ^ abc \# def $ abc#def y comments (#) ^^ abc \n ^^ def abc\ndef y line beginnings and endings (^^) # todo :pugs ^^ abc \n ^^ def \n ^^ abc\ndef\n n line beginnings and endings (^^) ^^ \n \n y line beginnings and endings (^^) # todo :pugs \n ^^ \n n line beginnings and endings (^^) abc $$ \n def $$ abc\ndef y line beginnings and endings ($$) # todo :pugs abc $$ \n def $$ \n $$ abc\ndef\n n line beginnings and endings ($$) $$ \n \n y line beginnings and endings ($$) # todo :pugs \n $$ \n n line beginnings and endings ($$) <[a..d]> | <[b..e]> c y alternation (|) <[a..d]> | <[d..e]> c y alternation (|) <[a..b]> | <[b..e]> c y alternation (|) <[a..b]> | <[d..e]> c n alternation (|) <[a..d]>+ | <[b..e]>+ bcd y alternation (|) ^ [ <[a..d]>+ | <[b..e]>+ ] $ bcd y alternation (|) ^ [ <[a..c]>+ | <[b..e]>+ ] $ bcd y alternation (|) ^ [ <[a..d]>+ | <[c..e]>+ ] $ bcd y alternation (|) b| bcd /rule error/ alternation (|) - null right arg illegal |b bcd y alternation (|) - null left arg ignored | bcd /Missing term/ alternation (|) - null both args illegal \| | y alternation (|) - literal must be escaped | | n alternation (|) - literal must be escaped # todo :pugs <[a..d]> & <[b..e]> c y conjunction (&) <[a..d]> & <[d..e]> c n conjunction (&) <[a..b]> & <[b..e]> c n conjunction (&) <[a..b]> & <[d..e]> c n conjunction (&) # todo :pugs <[a..d]>+ & <[b..e]>+ bcd y conjunction (&) # todo :pugs ^ [ <[a..d]>+ & <[b..e]>+ ] $ bcd y conjunction (&) # todo :pugs <[a..c]>+ & <[b..e]>+ bcd y conjunction (&) # todo :pugs <[a..d]>+ & <[c..e]>+ bcd y conjunction (&) b& bcd /rule error/ conjunction (&) - null right arg illegal &b bcd /Missing term/ conjunction (&) - null left arg illegal & bcd /Missing term/ conjunction (&) - null both args illegal \& & y conjunction (&) - literal must be escaped & & n conjunction (&) - literal must be escaped a&|b a&|b /Missing term/ alternation and conjunction (&|) - parse error a|&b a|&b /Missing term/ alternation and conjunction (|&) - parse error |d|b abc y leading alternation ignored |d|b abc y leading alternation ignored |d |b abc y leading alternation ignored | d | b abc y leading alternation ignored # todo :pugs b | | d abc n null pattern invalid \pabc pabc /reserved/ retired metachars (\p) \p{InConsonant} a /reserved/ retired metachars (\p) \Pabc Pabc /reserved/ retired metachars (\P) \P{InConsonant} a /reserved/ retired metachars (\P) \Labc\E LabcE /reserved/ retired metachars (\L...\E) \LABC\E abc /reserved/ retired metachars (\L...\E) \Uabc\E UabcE /reserved/ retired metachars (\U...\E) \Uabc\E ABC /reserved/ retired metachars (\U...\E) \Qabc\E QabcE /reserved/ retired metachars (\Q...\E) \Qabc d?\E abc d /reserved/ retired metachars (\Q...\E) \Gabc Gabc /reserved/ retired metachars (\G) \1abc 1abc /reserved/ retired metachars (\1) # todo :pugs ^ \s+ $ \x0009\x0020\x00a0\x000a\x000b\x000c\x000d\x0085 y 0-255 whitespace (\s) # todo :pugs ^ \h+ $ \x0009\x0020\x00a0 y 0-255 horizontal whitespace (\h) ^ \V+ $ \x0009\x0020\x00a0 y 0-255 horizontal whitespace (\h) # todo :pugs ^ \v+ $ \x000a\x000b\x000c\x000d\x0085 y 0-255 vertical whitespace (\v) ^ \H+ $ \x000a\x000b\x000c\x000d\x0085 y 0-255 vertical whitespace (\v) \h \x000a\x000b\x000c\x000d\x0085 n 0-255 horizontal whitespace (\h) \v \x0009\x0020\x00a0 n 0-255 vertical whitespace (\v) # todo :pugs ^ \s+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000\x000a\x000b\x000c\x000d\x0085 y unicode whitespace (\s) # todo :pugs ^ \h+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 y unicode whitespace (\h) ^ \V+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 y unicode whitespace (\h) # todo :pugs ^ \v+ $ \x000a\x000b\x000c\x000d\x0085 y unicode whitespace (\v) ^ \H+ $ \x000a\x000b\x000c\x000d\x0085 y unicode whitespace (\v) \h \x000a\x000b\x000c\x000d\x0085 n unicode whitespace (\h) \v \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 n unicode whitespace (\v) c \t d abc\tdef y horizontal tab (\t) # todo :pugs c \t d abc\o11def y horizontal tab (\t) # todo :pugs c \t d abc\x09def y horizontal tab (\t) c \t+ d abc\t\tdef y horizontal tab (\t) a \t+ f abcdef n horizontal tab (\t) b \t c abc\tdef n horizontal tab (\t) \T a y not horizontal tab (\T) a \T c abc y not horizontal tab (\T) \T '' n not horizontal tab (\T) c \T d abc\tdef n not horizontal tab (\T) c \T d abc\o11def n not horizontal tab (\T) c \T d abc\x09def n not horizontal tab (\T) c \T+ d abc\t\tdef n not horizontal tab (\T) a \T+ f abcdef y not horizontal tab (\T) c \r d abc\rdef y return (\r) # todo :pugs c \r d abc\o15def y return (\r) # todo :pugs c \r d abc\x0ddef y return (\r) c \r+ d abc\r\rdef y return (\r) a \r+ f abcdef n return (\r) b \r c abc\rdef n return (\r) \R a y not return (\R) a \R c abc y not return (\R) \R '' n not return (\R) c \R d abc\rdef n not return (\R) c \R d abc\o15def n not return (\R) c \R d abc\x0ddef n not return (\R) c \R+ d abc\r\rdef n not return (\R) a \R+ f abcdef y not return (\R) c \f d abc\fdef y formfeed (\f) # todo :pugs c \f d abc\o14def y formfeed (\f) # todo :pugs c \f d abc\x0cdef y formfeed (\f) c \f+ d abc\f\fdef y formfeed (\f) a \f+ f abcdef n formfeed (\f) b \f c abc\fdef n formfeed (\f) \F a y not formfeed (\F) a \F c abc y not formfeed (\F) \F '' n not formfeed (\F) c \F d abc\fdef n not formfeed (\F) c \F d abc\o14def n not formfeed (\F) c \F d abc\x0cdef n not formfeed (\F) c \F+ d abc\f\fdef n not formfeed (\F) a \F+ f abcdef y not formfeed (\F) # todo :pugs c \e d abc\edef y escape (\e) # todo :pugs c \e d abc\o33def y escape (\e) # todo :pugs c \e d abc\x1bdef y escape (\e) # todo :pugs c \e+ d abc\e\edef y escape (\e) a \e+ f abcdef n escape (\e) b \e c abc\edef n escape (\e) \E a y not escape (\E) a \E c abc y not escape (\E) \E '' n not escape (\E) # todo :pugs c \E d abc\edef n not escape (\E) c \E d abc\o33def n not escape (\E) # todo :pugs c \E d abc\x[1b]def n not escape (\E) # todo :pugs c \E+ d abc\e\edef n not escape (\E) a \E+ f abcdef y not escape (\E) c \x0021 d abc!def y hex (\x) # todo :pugs c \x0021 d abc\x[21]def y hex (\x) # todo :pugs c \x0021 d abc\o41def y hex (\x) c \x0021+ d abc!!def y hex (\x) a \x0021+ f abcdef n hex (\x) b \x0021 c abc!def n hex (\x) c \x[0021] d abc!def y hex (\x[]) # todo :pugs c \x[0021] d abc\x[21]def y hex (\x[]) # todo :pugs c \x[0021] d abc\o41def y hex (\x[]) c \x[0021]+ d abc!!def y hex (\x[]) # todo :pugs c \x[21,21] d abc!!def y hex (\x[]) a \x[0021]+ f abcdef n hex (\x[]) b \x[0021] c abc!def n hex (\x[]) \X0021 a y not hex (\X) a \X0021 c abc y not hex (\X) \X0021 '' n not hex (\X) c \X0021 d abc!def n not hex (\X) c \X0021 d abc\o41def n not hex (\X) # todo :pugs c \X0021 d abc\x[21]def n not hex (\X) c \X0021+ d abc!!def n not hex (\X) a \X0021+ f abcdef y not hex (\X) \X[0021] a y not hex (\X[]) a \X[0021] c abc y not hex (\X[]) \X[0021] '' n not hex (\X[]) c \X[0021] d abc!def n not hex (\X[]) c \X[0021] d abc\o41def n not hex (\X[]) # todo :pugs c \X[0021] d abc\x[21]def n not hex (\X[]) c \X[0021]+ d abc!!def n not hex (\X[]) a \X[0021]+ f abcdef y not hex (\X[]) c \o041 d abc!def y octal (\o) # todo :pugs c \o41 d abc\o41def y octal (\o) c \o41+ d abc!!def y octal (\o) a \o41+ f abcdef n octal (\o) b \o41 c abc!def n octal (\o) c \o[041] d abc!def y octal (\o[]) # todo :pugs c \o[41] d abc\o41def y octal (\o[]) c \o[41]+ d abc!!def y octal (\o[]) # todo :pugs c \o[41,41] d abc!!def y octal (\o[]) a \o[41]+ f abcdef n octal (\o[]) b \o[41] c abc!def n octal (\o[]) \O41 a y not octal (\O) a \O41 c abc y not octal (\O) \O41 '' n not octal (\O) c \O41 d abc!def n not octal (\O) c \O41 d abc\o41def n not octal (\O) c \O41+ d abc!!def n not octal (\O) a \O41+ f abcdef y not octal (\O) \O[41] a y not octal (\O[]) a \O[41] c abc y not octal (\O[]) \O[41] '' n not octal (\O[]) c \O[41] d abc!def n not octal (\O[]) c \O[41] d abc\o41def n not octal (\O[]) c \O[41]+ d abc!!def n not octal (\O[]) a \O[41]+ f abcdef y not octal (\O[]) a\w+f a=[ *f n word character a\w+f abcdef y word character a\W+f a&%- f y not word character a\W+f abcdef n not word character a\d+f abcdef n digit ab\d+cdef ab42cdef y digit a\D+f abcdef y not digit a\D+f ab0cdef n not digit ## Backtracking control tests a* a bazaar y control a*:a bazaar /:a/ basic a*: a bazaar n basic ^[a|b]* aba abbabbababba y control ^[a|b]*: aba abbabbababba n outside a group \d+: 123abc y cut on character class shortcut \d+: abc n cut on character class shortcut [ if not | ify ] verify y control [ if :: not | ify ] verify n inside a group if :: not | ify verify n the default all group # todo :pugs [ if : not | ify ] verify y simple backtrack still works # todo :pugs [ if :: not | ify ] | verify verify y rule continues [ when ever ] | whence whence y full backtrack failure [ when ::: ever ] | whence whence n full backtrack failure # todo :pugs ab::cd | gh::ij xyabghij y group cut at top ab:::cd | gh:::ij xyabghij n rule cut at top # todo :pugs [ab::cd | gh::ij] xyabghij y group cut in group [ab:::cd | gh:::ij] xyabghij n rule cut in group [ ab | abc ]: de xyzabcde n no backtrack into group ( ab | abc ): de xyzabcde n no backtrack into subpattern # todo :pugs [ when ever ] | whence whence n full backtrack failure ## Enumerated character lists <[c]> abcdef y character class # todo :pugs <[ z ]> abc def n character class ignores ws # todo :pugs <[dcb]>**{3} abcdef y repeated character class ^<[a]> abcdef y anchored character class <-[e]> abcdef y negated character class ^<[a]>? abcdef y anchored optional character class <-[e]>? abcdef y negated optional character class <-[dcb]>**{3} abcdef n repeated negated character class ^<-[e]> abcdef y anchored negated character class ^<-[a]> abcdef n anchored negated character class <[b..d]> abcdef y character range # todo :pugs <[b .. d]> c y character range ignores ws <[b..d]> abxxef y character range <[b..d]> axcxef y character range <[b..d]> axxdef y character range <[b..d]> axxxef n character range <-[b..d]> abcdef y negated character range # todo :pugs <- [b..d]> abcdef y negated allows ws <-[b..d]> bbccdd n negated character range <-[d..b]> bbccdd /parse error/ illegal character range <[\-]> ab-def y escaped hyphen <[\-]> abcdef n escaped hyphen <-[\-]> ---x-- y negated escaped hyphen <-[\-]> ------ n negated escaped hyphen <[\-+]> ab-def y escaped hyphen in range <[\-+]> ab+def y escaped hyphen in range <[\-+]> abcdef n escaped hyphen in range <[+\-]> ab-def y escaped hyphen in range <[+\-]> ab+def y escaped hyphen in range <[+\-]> abcdef n escaped hyphen in range <-[\-+]> ---x-- y negated escaped hyphen in range <-[\-+]> ------ n negated escaped hyphen in range <-[+\-]> ---x-- y negated escaped hyphen in range <-[+\-]> ------ n negated escaped hyphen in range ^><[<]> >< /rule error/ lt character class ^<[>]>< >< y gt character class # todo :pugs ^<[><]>**{2} >< y gt, lt character class # todo :pugs ^<[<>]>**{2} >< y lt, gt character class ^<-[><]> >< n not gt, lt character class ^<-[<>]> >< n not lt, gt character class '... --- ...' ... --- ... y literal match (\') '... --- ...' ...---... n literal match (\') # todo :pugs 'ab\'>cd' ab'>cd y literal match with quote 'ab"cd' ab"cd y literal match with quote # todo :pugs 'ab\\cd' ab\o134cd y literal match with backslash # todo :pugs "... --- ..." ... --- ... y literal match (\") "... --- ..." ...---... n literal match (\") # todo :pugs "ab<\">cd" ab<">cd y literal match with quote # todo :pugs "ab<'>cd" ab<'>cd y literal match with quote # todo :pugs "ab\\cd" ab\o134cd y literal match with backslash # todo :pugs (ab)x"$0" abxab y literal match with interpolation # todo :pugs (ab)"x$0" abxab y literal match with interpolation ## builtin subrules abc def \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij n def abc\ndef\n-==\nghi y word boundary \W\w abc abc\ndef\n-==\nghi y word boundary \w\W abc abc\ndef\n-==\nghi y BOS word boundary ghi abc\ndef\n-==\nghi y EOS word boundary a abc\ndef\n-==\nghi n \w\w word boundary \- abc\ndef\n-==\nghi n \W\W word boundary def abc\ndef\n-==\nghi n nonword boundary \W\w abc abc\ndef\n-==\nghi n nonword boundary \w\W abc abc\ndef\n-==\nghi n BOS nonword boundary ghi abc\ndef\n-==\nghi n EOS nonword boundary a abc\ndef\n-==\nghi y \w\w nonword boundary \- abc\ndef\n-==\nghi y \W\W nonword boundary \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0123456789 @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0123456789ABCDEF @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\s* @ 0>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\s* @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\s* @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t @ 0>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t @ 0>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <\t\n\r @ 0>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: / + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <.*\} @ 4>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0 @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <0123456789ABCDEFGHIJabcdefghij @ 35>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: < @ 3>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: < @ 3>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: << @ 21>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: << @ 21>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <> @ 23>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <> @ 23>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <. @ 17>/ + \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: <. @ 17>/ + 2+3 ab2 /mob: / capturing builtin ab::cd::x3::42 /mob: / capturing builtin ## lookarounds a. abacad /mob: / lookahead .... abacad n lookahead . abcd n null aa aabaaa /mob: / negated lookahead # todo :pugs b ab y lookbehind b cb n lookbehind b b n lookbehind # todo :pugs b ab y lookbehind b cb n lookbehind # todo :pugs b b y lookbehind >b dbcb n lookbehind # todo :pugs ><[ab]> dbaacb y lookbehind b dbcb n lookbehind # todo :pugs <[ab]> dbaacb y lookbehind # todo :pugs <[ab]> cbaccb y lookbehind # todo :pugs $ a y lookbehind # todo :pugs y axxbxxyc y lookbehind <[a..z]>+ az y metasyntax with leading + (<+...>) <+[a..z]>+ az y metasyntax with leading + (<+...>) <+alpha>+ az y metasyntax with leading + (<+...>) '' y null pattern () ^ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: < @ 0>/ null pattern () $ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /mob: < @ 65>/ null pattern () abc def \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern () x | y | \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern () x | y | \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern () a[b} \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /rule error/ mismatched close ## captures (a.)..(..) zzzabcdefzzz y basic match (a.)..(..) zzzabcdefzzz /mob: / basic $0 (a.)..(..) zzzabcdefzzz /mob 0: / basic $1 (a.)..(..) zzzabcdefzzz /mob 1: / basic $2 (a(b(c))(d)) abcd y nested match (a(b(c))(d)) abcd /mob: / nested match (a(b(c))(d)) abcd /mob 0: / nested match (a(b(c))(d)) abcd /mob 0 0: / nested match (a(b(c))(d)) abcd /mob 0 0 0: / nested match (a(b(c))(d)) abcd /mob 0 1: / nested match ((\w+)+) abcd /mob: / nested match ((\w+)+) abcd /mob 0: / nested match ((\w+)+) abcd /mob 0 0 0: / nested match ((\w+)+) ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /mob: <\w+ @ 0>/ nested match ((\w+)+) ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /mob 0: <\w+ @ 0>/ nested match ((\w+)+) ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz /mob 0 0 0: <\w+ @ 0>/ nested match (a) [ (bc) (d) | .* (ef) ] .* (g) abcdefg /mob 0: / alt subpattern before group (a) [ (bc) (d) | .* (ef) ] .* (g) abcdefg /mob 1: / alt subpattern in group (a) [ (bc) (d) | .* (ef) ] .* (g) abcdefg /mob 2: / alt subpattern in group (a) [ (bc) (d) | .* (ef) ] .* (g) abcdefg /mob 3: / alt subpattern after group (a) [ (bc) (x) | .* (ef) ] .* (g) abcdefg /mob 1: / 2nd alt subpattern in group (a) [ (bc) (x) | .* (ef) ] .* (g) abcdefg /mob 3: / 2nd alt subpattern after group ( (.) )* abc /mob 0 1 0: / nested repeated captures [ (.) ]* abc /mob 0 1: / nested repeated captures ( [.] )* abc /mob 0 1: / nested repeated captures (.) (.) $7:=(.) (.) $4:=(.) abcdefg /mob 0: / numbered aliases $1 (.) (.) $7:=(.) (.) $4:=(.) abcdefg /mob 1: / numbered aliases $2 (.) (.) $7:=(.) (.) $4:=(.) abcdefg /mob 7: / numbered aliases $7 (.) (.) $7:=(.) (.) $4:=(.) abcdefg /mob 8: / numbered aliases $8 (.) (.) $7:=(.) (.) $4:=(.) abcdefg /mob 4: / numbered aliases $4 $1:=[ (.) (.) (.) ] (.) abcdefg /mob 1: / perl5 numbered captures $1 $1:=[ (.) (.) (.) ] (.) abcdefg /mob 2: / perl5 numbered captures $1 $1:=[ (.) (.) (.) ] (.) abcdefg /mob 3: / perl5 numbered captures $1 $1:=[ (.) (.) (.) ] (.) abcdefg /mob 4: / perl5 numbered captures $1 $1:=[ (.) (.) (.) ] (.) abcdefg /mob 5: / perl5 numbered captures $1 #:s $:=[\w+] = $:=[\S+] abc = 123 /mob: / named capture #:s $:=[\w+] = $:=[\S+] abc = 123 /mob: <123 @ 7>/ named capture #:s (\w+) $:=(\w+) (\w+) abc def ghi /mob: / mixing named and unnamed capture #:s (\w+) $:=(\w+) (\w+) abc def ghi /mob 1: / mixing named and unnamed capture # [ \- ]? abc def ghi /mob 0: / multiple subrule captures in same scope #[(.)$0]+ bookkeeper y backreference #(\w+) $0 hello hello y backreference at end of string #[(.)$0]+ bookkeeper /mob 0 0: / backref $1 #[(.)$0]+ bookkeeper /mob 0 1: / backref $1 #[(.)$0]+ bookkeeper /mob 0 2: / backref $1 #(.)*x 123x /mob: <123x @ 0>/ repeated dot capture ## modifiers :i bcd abcdef y ignorecase (:i) :i bcd aBcdef y ignorecase (:i) :i bcd abCdef y ignorecase (:i) :i bcd abcDef y ignorecase (:i) :i bcd abc-ef n ignorecase (:i) :ignorecase bcd abcdef y ignorecase (:ignorecase) :ignorecase bcd aBCDef y ignorecase (:ignorecase) :ignorecase bcd abc-ef n ignorecase (:ignorecase) # todo :pugs :i(0) bcd abcdef y ignorecase, repetition (:i(0)) :i(0) bcd abCdef n ignorecase, repetition (:i(0)) # todo :pugs :i(1) bcd abcdef y ignorecase, repetition (:i(1)) # todo :pugs :i(1) bcd abCdef y ignorecase, repetition (:i(1)) :i(1) bcd aBxDef n ignorecase, repetition (:i(1)) # todo :pugs :0i bcd abcdef y ignorecase, repetition (:0i) :0i bcd abCdef n ignorecase, repetition (:0i) # todo :pugs :1i bcd abcdef y ignorecase, repetition (:1i) # todo :pugs :1i bcd abCdef y ignorecase, repetition (:1i) # todo :pugs :1i bcd aBCDef y ignorecase, repetition (:1i) :1i bcd aBxDef n ignorecase, repetition (:1i) ab [:i cd ] ef abcdef y ignorecase, lexical (:i) ab [:i cd ] ef abCdef y ignorecase, lexical (:i) ab [:i cd ] ef abcDef y ignorecase, lexical (:i) ab [:i cd ] ef abCDef y ignorecase, lexical (:i) ab [:i cd ] ef aBCDef n ignorecase, lexical (:i) ab [:i cd ] ef abCDEf n ignorecase, lexical (:i) :i ab [:i cd ] ef abCDef y ignorecase, lexical (:i) :i ab [:i cd ] ef AbCDeF y ignorecase, lexical (:i) :i ab [:i cd ] ef AbcdeF y ignorecase, lexical (:i) # todo :pugs :i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ] AbCdEf y ignorecase, lexical (:i) # todo :pugs :i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ] AabbCcddEeff y ignorecase, lexical (:i) :i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ] AbCdEF n ignorecase, lexical (:i) :i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ] AabbCcddEeFf n ignorecase, lexical (:i) # todo :pugs :i ab [:i(0) cd ] ef AbcdeF y ignorecase, lexical repetition (:i) # todo :pugs :i ab [:!i cd ] ef AbcdeF y ignorecase, lexical repetition (:i) # todo :pugs :i ab [:0i cd ] ef AbcdeF y ignorecase, lexical repetition (:i) # todo :pugs :0i ab [:1i cd ] ef abCDef y ignorecase, lexical repetition (:i) :0i ab [:1i cd ] ef AbCDeF n ignorecase, lexical repetition (:i) :0i ab [:1i cd ] ef AbcdeF n ignorecase, lexical repetition (:i) # todo :pugs :0i ab [:i(0) cd ] ef abcdef y ignorecase, lexical repetition (:i) :0i ab [:1i cd ] ef AbcdeF n ignorecase, lexical repetition (:i) # todo :pugs :i(1) ab [:1i cd ] ef AbCdeF y ignorecase, lexical repetition (:i) # todo :pugs :i(1) ab [:i(0) cd ] ef AbcdeF y ignorecase, lexical repetition (:i) :i(1) ab [:i(0) cd ] ef AbcDeF n ignorecase, lexical repetition (:i) # todo :pugs :i(2) ab [:i(999) cd ] ef ABCDEF y ignorecase, lexical repetition (:i) # todo :pugs :1i ab [:i(1) cd ] ef ABCDEF y ignorecase, lexical repetition (:i) :0i ab [:1i cd ] ef abcDeF n ignorecase, lexical repetition (:i) # todo :pugs :2i ab [:999i cd ] ef ABCDEF y ignorecase, lexical repetition (:i) ab [:ignorecase cd ] ef abCDef y ignorecase, lexical (:ignorecase) ab [:ignorecase cd ] ef aBCDef n ignorecase, lexical (:ignorecase) # todo :pugs :1ignorecase ab [:ignorecase(1) cd ] ef ABCDEF y ignorecase, lexical repetition (:ignorecase) # todo :pugs :s bcd a bcdef y sigspace (:s) # todo :pugs :s bcd a bcd ef y sigspace (:s) :s bcd abcdef n sigspace (:s) :s bcd abcd ef n sigspace (:s) :s bcd ab cdef n sigspace (:s) # todo :pugs :s b c d a b c d ef y sigspace (:s) # todo :pugs :s b c d a b c def y sigspace (:s) :s b c d ab c d ef n sigspace (:s) :s b c d a bcdef n sigspace (:s) :s b c d abcdef n sigspace (:s) # todo :pugs :sigspace bcd a bcdef y sigspace (:sigspace) # todo :pugs :sigspace bcd a bcd ef y sigspace (:sigspace) :sigspace bcd abcdef n sigspace (:sigspace) # todo :pugs :sigspace b c d a b c d ef y sigspace (:sigspace) # todo :pugs :sigspace b c d a b c def y sigspace (:sigspace) :sigspace b c d ab c d ef n sigspace (:sigspace) # todo :pugs :s(1) b c [:s(0) d e f ] a b c def y sigspace, lexical repetition (:s) # todo :pugs :s(1) b c [:s(0) d e f ] a b c def y sigspace, lexical repetition (:s) # todo :pugs :s b c [:!s d e f ] a b c def y sigspace, lexical repetition (:s) :s(0) b c [:s(1) d e f ] a b c def n sigspace, lexical repetition (:s) :!s b c [:s d e f ] a b c def n sigspace, lexical repetition (:s) :s(0) b c [:s(0) d e f ] a b c def n sigspace, lexical repetition (:s) :!s b c [:!s d e f ] a b c def n sigspace, lexical repetition (:s) # todo :pugs :s ab ab y sigspace, trailing ws foo\s*'-'?\s*bar foo\t \n-\n\t bar y basic match foo\s*'-'?\s*bar foo - bar y basic match foo\s+'-'?\s*bar foo bar y basic match \s+ \s* foo\s+'-'?\s*bar foo -bar y basic match \s+ \s* foo\s*'-'?\s+bar foo- bar y basic match \s* \s+ foo '-'? bar foo-bar y basic match \s* \s* foo '-'? bar foobar y basic match foo '-'? bar foo - bar n basic non-match # todo :pugs :s foo '-'? bar foo\n \t- \t\t\nbar y basic ws match # todo :pugs :s foo '-'? bar foo - bar y basic ws match # todo :pugs :s foo '-'? bar foo bar y basic ws match \s+ \s* # todo :pugs :s foo '-'? bar foo -bar y basic ws match \s+ \s* # todo :pugs :s foo '-'? bar foo- bar y basic ws match \s* \s+ # todo :pugs :s foo '-'? bar foo-bar y basic ws match \s* \s* :s foo '-'? bar foobar n basic ws non-match :s()foo '-'? bar foo - bar n basic ws match # todo :pugs :s[]foo '-'? bar foo - bar y basic ws match # todo :pugs :sfoo '-'? bar foo - bar y basic ws match with boundary modifier separation # todo :pugs :s::foo '-'? bar foo - bar y basic ws match with backtrack no-op modifier separation :s::(\w+) \:= (\S+) dog := spot /mob 0: / sigspace and capture together :s::(\w+) \:= (\S+) dog := spot /mob 1: / sigspace and capture together # todo :pugs :perl5 \A.*? bcd\Q$\E..\z a bcd$ef y perl5 syntax (:perl5) # todo :pugs :x(6) \d 123456 y repetition (:x) # todo :pugs :x(3) \d 123456 y repetition (:x) # todo :pugs :x(0) \d 123456 y repetition (:x) # todo :pugs :nth(3) a \d a1a2a3 y nth occurance (:nth) :nth(4) a \d a1a2a3 n nth occurance (:nth) :nth(0) a \d a1a2a3 n nth occurance (:nth)