# This set of tests check the DFA matching functionality of pcre2_dfa_match(), # excluding UTF and Unicode property support. All matches are done using DFA, # forced by setting a default subject modifier at the start. #forbid_utf #subject dfa #newline_default lf anycrlf any /abc/ abc /ab*c/ abc abbbbc ac /ab+c/ abc abbbbbbc \= Expect no match ac ab /a*/no_auto_possess a aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=dfa_shortest /(a|abcd|african)/ a abcd african /^abc/ abcdef \= Expect no match xyzabc xyz\nabc /^abc/m abcdef xyz\nabc \= Expect no match xyzabc /\Aabc/ abcdef \= Expect no match xyzabc xyz\nabc /\Aabc/m abcdef \= Expect no match xyzabc xyz\nabc /\Gabc/ abcdef xyzabc\=offset=3 \= Expect no match xyzabc xyzabc\=offset=2 /x\dy\Dz/ x9yzz x0y+z \= Expect no match xyz xxy0z /x\sy\Sz/ x yzz x y+z \= Expect no match xyz xxyyz /x\wy\Wz/ xxy+z \= Expect no match xxy0z x+y+z /x.y/ x+y x-y \= Expect no match x\ny /x.y/s x+y x-y x\ny /(a.b(?s)c.d|x.y)p.q/ a+bc+dp+q a+bc\ndp+q x\nyp+q \= Expect no match a\nbc\ndp+q a+bc\ndp\nq x\nyp\nq /a\d\z/ ba0 \= Expect no match ba0\n ba0\ncd /a\d\z/m ba0 \= Expect no match ba0\n ba0\ncd /a\d\Z/ ba0 ba0\n \= Expect no match ba0\ncd /a\d\Z/m ba0 ba0\n \= Expect no match ba0\ncd /a\d$/ ba0 ba0\n \= Expect no match ba0\ncd /a\d$/m ba0 ba0\n ba0\ncd /abc/i abc aBc ABC /[^a]/ abcd /ab?\w/ abz abbz azz /x{0,3}yz/ ayzq axyzq axxyz axxxyzq axxxxyzq \= Expect no match ax axx /x{3}yz/ axxxyzq axxxxyzq \= Expect no match ax axx ayzq axyzq axxyz /x{2,3}yz/ axxyz axxxyzq axxxxyzq \= Expect no match ax axx ayzq axyzq /[^a]+/no_auto_possess bac bcdefax \= Expect no match aaaaa /[^a]*/no_auto_possess bac bcdefax aaaaa /[^a]{3,5}/no_auto_possess xyz awxyza abcdefa abcdefghijk \= Expect no match axya axa aaaaa /\d*/ 1234b567 xyz /\D*/ a1234b567 xyz /\d+/ ab1234c56 \= Expect no match xyz /\D+/ ab123c56 \= Expect no match 789 /\d?A/ 045ABC ABC \= Expect no match XYZ /\D?A/ ABC BAC 9ABC /a+/ aaaa /^.*xyz/ xyz ggggggggxyz /^.+xyz/ abcdxyz axyz \= Expect no match xyz /^.?xyz/ xyz cxyz /^\d{2,3}X/ 12X 123X \= Expect no match X 1X 1234X /^[abcd]\d/ a45 b93 c99z d04 \= Expect no match e45 abcd abcd1234 1234 /^[abcd]*\d/ a45 b93 c99z d04 abcd1234 1234 \= Expect no match e45 abcd /^[abcd]+\d/ a45 b93 c99z d04 abcd1234 \= Expect no match 1234 e45 abcd /^a+X/ aX aaX /^[abcd]?\d/ a45 b93 c99z d04 1234 \= Expect no match abcd1234 e45 /^[abcd]{2,3}\d/ ab45 bcd93 \= Expect no match 1234 a36 abcd1234 ee45 /^(abc)*\d/ abc45 abcabcabc45 42xyz /^(abc)+\d/ abc45 abcabcabc45 \= Expect no match 42xyz /^(abc)?\d/ abc45 42xyz \= Expect no match abcabcabc45 /^(abc){2,3}\d/ abcabc45 abcabcabc45 \= Expect no match abcabcabcabc45 abc45 42xyz /1(abc|xyz)2(?1)3/ 1abc2abc3456 1abc2xyz3456 /^(a*\w|ab)=(a*\w|ab)/ ab=ab /^(a*\w|ab)=(?1)/ ab=ab /^([^()]|\((?1)*\))*$/ abc a(b)c a(b(c))d \= Expect no match) a(b(c)d /^>abc>([^()]|\((?1)*\))*abc>123abc>1(2)3abc>(1(2)3)a*)\d/ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876 \= Expect no match aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x <> hij> hij> def> \= Expect no match >>aaabxyzpqrrrabbxyyyypqAzz >aaaabxyzpqrrrabbxyyyypqAzz >>>>abcxyzpqrrrabbxyyyypqAzz \= Expect no match abxyzpqrrabbxyyyypqAzz abxyzpqrrrrabbxyyyypqAzz abxyzpqrrrabxyyyypqAzz aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz aaaabcxyzzzzpqrrrabbbxyyypqAzz aaabcxyzpqrrrabbxyyyypqqqqqqqAzz /^(abc){1,2}zz/ abczz abcabczz \= Expect no match zz abcabcabczz >>abczz /^(b+?|a){1,2}?c/ bc bbc bbbc bac bbac aac abbbbbbbbbbbc bbbbbbbbbbbac \= Expect no match aaac abbbbbbbbbbbac /^(b+|a){1,2}c/ bc bbc bbbc bac bbac aac abbbbbbbbbbbc bbbbbbbbbbbac \= Expect no match aaac abbbbbbbbbbbac /^(b+|a){1,2}?bc/ bbc /^(b*|ba){1,2}?bc/ babc bbabc bababc \= Expect no match bababbc babababc /^(ba|b*){1,2}?bc/ babc bbabc bababc \= Expect no match bababbc babababc /^\ca\cA\c[\c{\c:/ \x01\x01\e;z /^[ab\]cde]/ athing bthing ]thing cthing dthing ething \= Expect no match fthing [thing \\thing /^[]cde]/ ]thing cthing dthing ething \= Expect no match athing fthing /^[^ab\]cde]/ fthing [thing \\thing \= Expect no match athing bthing ]thing cthing dthing ething /^[^]cde]/ athing fthing \= Expect no match ]thing cthing dthing ething /^\/ /^/ /^[0-9]+$/ 0 1 2 3 4 5 6 7 8 9 10 100 \= Expect no match abc /^.*nter/ enter inter uponter /^xxx[0-9]+$/ xxx0 xxx1234 \= Expect no match xxx /^.+[0-9][0-9][0-9]$/ x123 xx123 123456 x1234 \= Expect no match 123 /^.+?[0-9][0-9][0-9]$/ x123 xx123 123456 x1234 \= Expect no match 123 /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ abc!pqr=apquxz.ixr.zzz.ac.uk \= Expect no match !pqr=apquxz.ixr.zzz.ac.uk abc!=apquxz.ixr.zzz.ac.uk abc!pqr=apquxz:ixr.zzz.ac.uk abc!pqr=apquxz.ixr.zzz.ac.ukk /:/ Well, we need a colon: somewhere \= Expect no match No match without a colon /([\da-f:]+)$/i 0abc abc fed E :: 5f03:12C0::932e fed def Any old stuff \= Expect no match 0zzz gzzz fed\x20 Any old rubbish /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ .1.2.3 A.12.123.0 \= Expect no match .1.2.3333 1.2.3 1234.2.3 /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 1 IN SOA non-sp1 non-sp2( 1 IN SOA non-sp1 non-sp2 ( \= Expect no match 1IN SOA non-sp1 non-sp2( /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ a. Z. 2. ab-c.pq-r. sxk.zzz.ac.uk. x-.y-. \= Expect no match -abc.peq. /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ *.a *.b0-a *.c3-b.c *.c-a.b-c \= Expect no match *.0 *.a- *.a-b.c- *.c-a.0-c /^(?=ab(de))(abd)(e)/ abde /^(?!(ab)de|x)(abd)(f)/ abdf /^(?=(ab(cd)))(ab)/ abcd /^[\da-f](\.[\da-f])*$/i a.b.c.d A.B.C.D a.b.c.1.2.3.C /^\".*\"\s*(;.*)?$/ \"1234\" \"abcd\" ; \"\" ; rhubarb \= Expect no match \"1234\" : things /^$/ \ / ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x ab c \= Expect no match abc ab cde /(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ ab c \= Expect no match abc ab cde /^ a\ b[c ]d $/x a bcd a b d \= Expect no match abcd ab d /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ abcdefhijklm /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ abcdefhijklm /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ a+ Z0+\x08\n\x1d\x12 /^[.^$|()*+?{,}]+/ .^\$(*+)|{?,?} /^a*\w/ z az aaaz a aa aaaa a+ aa+ /^a*?\w/ z az aaaz a aa aaaa a+ aa+ /^a+\w/ az aaaz aa aaaa aa+ /^a+?\w/ az aaaz aa aaaa aa+ /^\d{8}\w{2,}/ 1234567890 12345678ab 12345678__ \= Expect no match 1234567 /^[aeiou\d]{4,5}$/ uoie 1234 12345 aaaaa \= Expect no match 123456 /^[aeiou\d]{4,5}?/ uoie 1234 12345 aaaaa 123456 /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/ From abcd Mon Sep 01 12:33:02 1997 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ From abcd Mon Sep 01 12:33:02 1997 From abcd Mon Sep 1 12:33:02 1997 \= Expect no match From abcd Sep 01 12:33:02 1997 /^12.34/s 12\n34 12\r34 /\w+(?=\t)/ the quick brown\t fox /foo(?!bar)(.*)/ foobar is foolish see? /(?:(?!foo)...|^.{0,2})bar(.*)/ foobar crowbar etc barrel 2barrel A barrel /^(\D*)(?=\d)(?!123)/ abc456 \= Expect no match abc123 /^1234(?# test newlines inside)/ 1234 /^1234 #comment in extended re /x 1234 /#rhubarb abcd/x abcd /^abcd#rhubarb/x abcd /(?!^)abc/ the abc \= Expect no match abc /(?=^)abc/ abc \= Expect no match the abc /^[ab]{1,3}(ab*|b)/no_auto_possess aabbbbb /^[ab]{1,3}?(ab*|b)/no_auto_possess aabbbbb /^[ab]{1,3}?(ab*?|b)/no_auto_possess aabbbbb /^[ab]{1,3}(ab*?|b)/no_auto_possess aabbbbb / (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # optional leading comment (?: (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote ) # initial word (?: (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote ) )* # further okay, if led by a period (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* @ (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # initial subdomain (?: # (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. # if led by a period... (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # ...further okay )* # address | # or (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote ) # one word, optionally followed by.... (?: [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) | # comments, or... " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote # quoted strings )* < (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # leading < (?: @ (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # initial subdomain (?: # (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. # if led by a period... (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # ...further okay )* (?: (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* , (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* @ (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # initial subdomain (?: # (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. # if led by a period... (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # ...further okay )* )* # further okay, if led by comma : # closing colon (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* )? # optional route (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote ) # initial word (?: (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | " (?: # opening quote... [^\\\x80-\xff\n\015"] # Anything except backslash and quote | # or \\ [^\x80-\xff] # Escaped something (something != CR) )* " # closing quote ) )* # further okay, if led by a period (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* @ (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # initial subdomain (?: # (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* \. # if led by a period... (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) # ...further okay )* # address spec (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* > # trailing > # name and address ) (?: [\040\t] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # optional trailing comment /x Alan Other user\@dom.ain \"A. Other\" (a comment) A. Other (a comment) \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay A missing angle @,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom # Atom | # or " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " # Quoted string ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom # Atom | # or " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " # Quoted string ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # additional words )* @ [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments )* # address | # or (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom # Atom | # or " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " # Quoted string ) # leading word [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces (?: (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) | " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " ) # "special" comment or quoted string [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" )* < [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # < (?: @ [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments )* (?: , [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. @ [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments )* )* # additional domains : [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments )? # optional route (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom # Atom | # or " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " # Quoted string ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom # Atom | # or " # " [^\\\x80-\xff\n\015"] * # normal (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* " # " # Quoted string ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # additional words )* @ [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments (?: \. [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. (?: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom | \[ # [ (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff \] # ] ) [\040\t]* # Nab whitespace. (?: \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: # ( (?: \\ [^\x80-\xff] | \( # ( [^\\\x80-\xff\n\015()] * # normal* (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* \) # ) ) # special [^\\\x80-\xff\n\015()] * # normal* )* # )* \) # ) [\040\t]* )* # If comment found, allow more spaces. # optional trailing comments )* # address spec > # > # name and address ) /x Alan Other user\@dom.ain \"A. Other\" (a comment) A. Other (a comment) \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay A missing angle ]{0,})>]{0,})>([\d]{0,}\.)(.*)((
([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is 43.Word Processor
(N-1286)
Lega lstaff.comCA - Statewide /a[^a]b/ acb a\nb /a.b/ acb \= Expect no match a\nb /a[^a]b/s acb a\nb /a.b/s acb a\nb /^(b+?|a){1,2}?c/ bac bbac bbbac bbbbac bbbbbac /^(b+|a){1,2}?c/ bac bbac bbbac bbbbac bbbbbac /(?!\A)x/m a\bx\n \= Expect no match x\nb\n /\x0{ab}/ \0{ab} /(A|B)*?CD/ CD /(A|B)*CD/ CD /(?.*/)foo" \= Expect no match /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ "(?>.*/)foo" /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo /(?>(\.\d\d[1-9]?))\d+/ 1.230003938 1.875000282 \= Expect no match 1.235 /^((?>\w+)|(?>\s+))*$/ now is the time for all good men to come to the aid of the party \= Expect no match this is not a line with only words and spaces! /(\d+)(\w)/ 12345a 12345+ /((?>\d+))(\w)/ 12345a \= Expect no match 12345+ /(?>a+)b/ aaab /((?>a+)b)/ aaab /(?>(a+))b/ aaab /(?>b)+/ aaabbbccc /(?>a+|b+|c+)*c/ aaabbbbccccd /(a+|b+|c+)*c/ aaabbbbccccd /((?>[^()]+)|\([^()]*\))+/ ((abc(ade)ufh()()x /\(((?>[^()]+)|\([^()]+\))+\)/ (abc) (abc(def)xyz) \= Expect no match ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /a(?-i)b/i ab Ab \= Expect no match aB AB /(a (?x)b c)d e/ a bcd e \= Expect no match a b cd e abcd e a bcde /(a b(?x)c d (?-x)e f)/ a bcde f \= Expect no match abcdef /(a(?i)b)c/ abc aBc \= Expect no match abC aBC Abc ABc ABC AbC /a(?i:b)c/ abc aBc \= Expect no match ABC abC aBC /a(?i:b)*c/ aBc aBBc \= Expect no match aBC aBBC /a(?=b(?i)c)\w\wd/ abcd abCd \= Expect no match aBCd abcD /(?s-i:more.*than).*million/i more than million more than MILLION more \n than Million \= Expect no match MORE THAN MILLION more \n than \n million /(?:(?s-i)more.*than).*million/i more than million more than MILLION more \n than Million \= Expect no match MORE THAN MILLION more \n than \n million /(?>a(?i)b+)+c/ abc aBbc aBBc \= Expect no match Abc abAb abbC /(?=a(?i)b)\w\wc/ abc aBc \= Expect no match Ab abC aBC /(?<=a(?i)b)(\w\w)c/ abxxc aBxxc \= Expect no match Abxxc ABxxc abxxC /^(?(?=abc)\w{3}:|\d\d)$/ abc: 12 \= Expect no match 123 xyz /^(?(?!abc)\d\d|\w{3}:)$/ abc: 12 \= Expect no match 123 xyz /(?(?<=foo)bar|cat)/ foobar cat fcat focat \= Expect no match foocat /(?(?a*)*/ a aa aaaa /(abc|)+/ abc abcabc abcabcabc xyz /([a]*)*/ a aaaaa /([ab]*)*/ a b ababab aaaabcde bbbb /([^a]*)*/ b bbbb aaa /([^ab]*)*/ cccc abab /([a]*?)*/ a aaaa /([ab]*?)*/ a b abab baba /([^a]*?)*/ b bbbb aaa /([^ab]*?)*/ c cccc baba /(?>a*)*/ a aaabcde /((?>a*))*/ aaaaa aabbaa /((?>a*?))*/ aaaaa aabbaa /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x 12-sep-98 12-09-98 \= Expect no match sep-12-98 /(?i:saturday|sunday)/ saturday sunday Saturday Sunday SATURDAY SUNDAY SunDay /(a(?i)bc|BB)x/ abcx aBCx bbx BBx \= Expect no match abcX aBCX bbX BBX /^([ab](?i)[cd]|[ef])/ ac aC bD elephant Europe frog France \= Expect no match Africa /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ ab aBd xy xY zebra Zambesi \= Expect no match aCD XY /(?<=foo\n)^bar/m foo\nbar \= Expect no match bar baz\nbar /(?<=(?]&/ <&OUT /(?:(f)(o)(o)|(b)(a)(r))*/ foobar /(?<=a)b/ ab \= Expect no match cb b /(?a+)ab/ /(?>a+)b/ aaab /([[:]+)/ a:[b]: /([[=]+)/ a=[b]= /([[.]+)/ a.[b]. /((?>a+)b)/ aaab /(?>(a+))b/ aaab /((?>[^()]+)|\([^()]*\))+/ ((abc(ade)ufh()()x /a\Z/ \= Expect no match aaab a\nb\n /b\Z/ a\nb\n /b\z/ /b\Z/ a\nb /b\z/ a\nb /(?>.*)(?<=(abcd|wxyz))/ alphabetabcd endingwxyz \= Expect no match a rather long string that doesn't end with one of them /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ word cat dog elephant mussel cow horse canary baboon snake shark otherword \= Expect no match word cat dog elephant mussel cow horse canary baboon snake shark /word (?>[a-zA-Z0-9]+ ){0,30}otherword/ \= Expect no match word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope /(?<=\d{3}(?!999))foo/ 999foo 123999foo \= Expect no match 123abcfoo /(?<=(?!...999)\d{3})foo/ 999foo 123999foo \= Expect no match 123abcfoo /(?<=\d{3}(?!999)...)foo/ 123abcfoo 123456foo \= Expect no match 123999foo /(?<=\d{3}...)(?Z)+|A)*/ ZABCDEFG /((?>)+|A)*/ ZABCDEFG /a*/g abbab /[[:space:]]+/ > \x09\x0a\x0c\x0d\x0b< /[[:blank:]]+/ > \x09\x0a\x0c\x0d\x0b< /[\s]+/ > \x09\x0a\x0c\x0d\x0b< /\s+/ > \x09\x0a\x0c\x0d\x0b< /a b/x ab /(?!\A)x/m a\nxb\n /(?!^)x/m \= Expect no match a\nxb\n /abc\Qabc\Eabc/ abcabcabc /abc\Q(*+|\Eabc/ abc(*+|abc / abc\Q abc\Eabc/x abc abcabc \= Expect no match abcabcabc /abc#comment \Q#not comment literal\E/x abc#not comment\n literal /abc#comment \Q#not comment literal/x abc#not comment\n literal /abc#comment \Q#not comment literal\E #more comment /x abc#not comment\n literal /abc#comment \Q#not comment literal\E #more comment/x abc#not comment\n literal /\Qabc\$xyz\E/ abc\\\$xyz /\Qabc\E\$\Qxyz\E/ abc\$xyz /\Gabc/ abc \= Expect no match xyzabc /\Gabc./g abc1abc2xyzabc3 /abc./g abc1abc2xyzabc3 /a(?x: b c )d/ XabcdY \= Expect no match Xa b c d Y /((?x)x y z | a b c)/ XabcY AxyzB /(?i)AB(?-i)C/ XabCY \= Expect no match XabcY /((?i)AB(?-i)C|D)E/ abCE DE \= Expect no match abcE abCe dE De /[z\Qa-d]\E]/ z a - d ] \= Expect no match b /(a+)*b/ \= Expect no match aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /(?i)reg(?:ul(?:[a]|ae)r|ex)/ REGular regulaer Regex regulr /[--]+/ /(?<=Z)X./ \x84XAZXB /^(?(2)a|(1)(2))+$/ 123a /(?<=a|bbbb)c/ ac bbbbc /line\nbreak/ this is a line\nbreak line one\nthis is a line\nbreak in the second line /line\nbreak/firstline this is a line\nbreak \= Expect no match line one\nthis is a line\nbreak in the second line /line\nbreak/m,firstline this is a line\nbreak \= Expect no match line one\nthis is a line\nbreak in the second line /1234/ 123\=ps \= Expect no match a4\=ps,dfa_restart /1234/ 123\=ps 4\=ps,dfa_restart /^/gm a\nb\nc\n \ /(?<=C\n)^/gm A\nC\nC\n /(?s)A?B/ AB aB /(?s)A*B/ AB aB /(?m)A?B/ AB aB /(?m)A*B/ AB aB /Content-Type\x3A[^\r\n]{6,}/ Content-Type:xxxxxyyy /Content-Type\x3A[^\r\n]{6,}z/ Content-Type:xxxxxyyyz /Content-Type\x3A[^a]{6,}/ Content-Type:xxxyyy /Content-Type\x3A[^a]{6,}z/ Content-Type:xxxyyyz /^abc/Im,newline=lf xyz\nabc xyz\r\nabc \= Expect no match xyz\rabc xyzabc\r xyzabc\rpqr xyzabc\r\n xyzabc\r\npqr /^abc/Im,newline=crlf xyz\r\nabclf> \= Expect no match xyz\nabclf xyz\rabclf /^abc/Im,newline=cr xyz\rabc \= Expect no match xyz\nabc xyz\r\nabc /.*/I,newline=lf abc\ndef abc\rdef abc\r\ndef /.*/I,newline=cr abc\ndef abc\rdef abc\r\ndef /.*/I,newline=crlf abc\ndef abc\rdef abc\r\ndef /\w+(.)(.)?def/Is abc\ndef abc\rdef abc\r\ndef /\w+(.)(.)?def/s abc\ndef abc\rdef abc\r\ndef /^\w+=.*(\\\n.*)*/ abc=xyz\\\npqr /^(a()*)*/ aaaa /^(?:a(?:(?:))*)*/ aaaa /^(a()+)+/ aaaa /^(?:a(?:(?:))+)+/ aaaa /(a|)*\d/ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 \= Expect no match aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /(?>a|)*\d/ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 \= Expect no match aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /(?:a|)*\d/ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 \= Expect no match aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /^a.b/newline=lf a\rb \= Expect no match a\nb /^a.b/newline=cr a\nb \= Expect no match a\rb /^a.b/newline=anycrlf a\x85b \= Expect no match a\rb /^a.b/newline=any \= Expect no match a\nb a\rb a\x85b /^abc./gmx,newline=any abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK /abc.$/gmx,newline=any abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9 /^a\Rb/bsr=unicode a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b \= Expect no match a\n\rb /^a\R*b/bsr=unicode ab a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b a\n\rb a\n\r\x85\x0cb /^a\R+b/bsr=unicode a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b a\n\rb a\n\r\x85\x0cb \= Expect no match ab /^a\R{1,3}b/bsr=unicode a\nb a\n\rb a\n\r\x85b a\r\n\r\nb a\r\n\r\n\r\nb a\n\r\n\rb a\n\n\r\nb \= Expect no match a\n\n\n\rb a\r /.+foo/ afoo \= Expect no match \r\nfoo \nfoo /.+foo/newline=crlf afoo \nfoo \= Expect no match \r\nfoo /.+foo/newline=any afoo \= Expect no match \nfoo \r\nfoo /.+foo/s afoo \r\nfoo \nfoo /^$/gm,newline=any abc\r\rxyz abc\n\rxyz \= Expect no match abc\r\nxyz /^X/m XABC \= Expect no match XABC\=notbol /(?m)^$/g,newline=any,aftertext abc\r\n\r\n /(?m)^$|^\r\n/g,newline=any,aftertext abc\r\n\r\n /(?m)$/g,newline=any,aftertext abc\r\n\r\n /(?|(abc)|(xyz))/ >abc< >xyz< /(x)(?|(abc)|(xyz))(x)/ xabcx xxyzx /(x)(?|(abc)(pqr)|(xyz))(x)/ xabcpqrx xxyzx /(?|(abc)|(xyz))(?1)/ abcabc xyzabc \= Expect no match xyzxyz /\H\h\V\v/ X X\x0a X\x09X\x0b \= Expect no match \xa0 X\x0a /\H*\h+\V?\v{3,4}/ \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a \x09\x20\xa0\x0a\x0b\x0c \= Expect no match \x09\x20\xa0\x0a\x0b /\H{3,4}/ XY ABCDE XY PQR ST /.\h{3,4}./ XY AB PQRS /\h*X\h?\H+Y\H?Z/ >XNNNYZ > X NYQZ \= Expect no match >XYZ > X NY Z /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/ >XY\x0aZ\x0aA\x0bNN\x0c >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c /.+A/newline=crlf \= Expect no match \r\nA /\nA/newline=crlf \r\nA /[\r\n]A/newline=crlf \r\nA /(\r|\n)A/newline=crlf \r\nA /a\Rb/I,bsr=anycrlf a\rb a\nb a\r\nb \= Expect no match a\x85b a\x0bb /a\Rb/I,bsr=unicode a\rb a\nb a\r\nb a\x85b a\x0bb /a\R?b/I,bsr=anycrlf a\rb a\nb a\r\nb \= Expect no match a\x85b a\x0bb /a\R?b/I,bsr=unicode a\rb a\nb a\r\nb a\x85b a\x0bb /a\R{2,4}b/I,bsr=anycrlf a\r\n\nb a\n\r\rb a\r\n\r\n\r\n\r\nb \= Expect no match a\x0b\x0bb a\x85\x85b /a\R{2,4}b/I,bsr=unicode a\r\rb a\n\n\nb a\r\n\n\r\rb a\x85\x85b a\x0b\x0bb \= Expect no match a\r\r\r\r\rb /a(?!)|\wbc/ abc /a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames \= Expect no match ab /a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames \= Expect no match ab /a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames \= Expect no match ab /a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames aXb a\nb \= Expect no match ab /a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames aXb a\nX\nXb \= Expect no match ab /X$/dollar_endonly X \= Expect no match X\n /X$/ X X\n /xyz/auto_callout xyz abcxyz \= Expect no match abc abcxypqr /xyz/auto_callout,no_start_optimize abcxyz \= Expect no match abc abcxypqr /(*NO_START_OPT)xyz/auto_callout abcxyz /(?C)ab/ ab ab\=callout_none /ab/auto_callout ab ab\=callout_none /^"((?(?=[a])[^"])|b)*"$/auto_callout "ab" "ab"\=callout_none /\d+X|9+Y/ ++++123999\=ps ++++123999Y\=ps /Z(*F)/ \= Expect no match Z\=ps ZA\=ps /Z(?!)/ \= Expect no match Z\=ps ZA\=ps /dog(sbody)?/ dogs\=ps dogs\=ph /dog(sbody)??/ dogs\=ps dogs\=ph /dog|dogsbody/ dogs\=ps dogs\=ph /dogsbody|dog/ dogs\=ps dogs\=ph /Z(*F)Q|ZXY/ Z\=ps \= Expect no match ZA\=ps X\=ps /\bthe cat\b/ the cat\=ps the cat\=ph /dog(sbody)?/ dogs\=ps body\=dfa_restart /dog(sbody)?/ dogs\=ph body\=dfa_restart /abc/ abc\=ps abc\=ph /abc\K123/ xyzabc123pqr /(?<=abc)123/allusedtext xyzabc123pqr xyzabc12\=ps xyzabc12\=ph /\babc\b/allusedtext +++abc+++ +++ab\=ps +++ab\=ph /(?=C)/g,aftertext ABCDECBA /(abc|def|xyz)/I terhjk;abcdaadsfe the quick xyz brown fox \= Expect no match thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd /(abc|def|xyz)/I,no_start_optimize terhjk;abcdaadsfe the quick xyz brown fox \= Expect no match thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd /abcd*/aftertext xxxxabcd\=ps xxxxabcd\=ph dddxxx\=dfa_restart xxxxabcd\=ph xxx\=dfa_restart /abcd*/i xxxxabcd\=ps xxxxabcd\=ph XXXXABCD\=ps XXXXABCD\=ph /abc\d*/ xxxxabc1\=ps xxxxabc1\=ph /abc[de]*/ xxxxabcde\=ps xxxxabcde\=ph /(?:(?1)|B)(A(*F)|C)/ ABCD CCD \= Expect no match CAD /^(?:(?1)|B)(A(*F)|C)/ CCD BCD \= Expect no match ABCD CAD BAD /^(?!a(*SKIP)b)/ ac /^(?=a(*SKIP)b|ac)/ ac /^(?=a(*THEN)b|ac)/ ac /^(?=a(*PRUNE)b)/ ab /^(?(?!a(*SKIP)b))/ ac /(?<=abc)def/allusedtext abc\=ph /abc$/ abc abc\=ps abc\=ph /abc$/m abc abc\n abc\=ph abc\n\=ph abc\=ps abc\n\=ps /abc\z/ abc abc\=ps abc\=ph /abc\Z/ abc abc\=ps abc\=ph /abc\b/ abc abc\=ps abc\=ph /abc\B/ abc\=ps abc\=ph \= Expect no match abc /.+/ abc\=offset=0 abc\=offset=1 abc\=offset=2 \= Bad offsets abc\=offset=4 abc\=offset=-4 \= Expect no match abc\=offset=3 /^(?:a)++\w/ aaaab \= Expect no match aaaa bbb /^(?:aa|(?:a)++\w)/ aaaab aaaa \= Expect no match bbb /^(?:a)*+\w/ aaaab bbb \= Expect no match aaaa /^(a)++\w/ aaaab \= Expect no match aaaa bbb /^(a|)++\w/ aaaab \= Expect no match aaaa bbb /(?=abc){3}abc/aftertext abcabcabc \= Expect no match xyz /(?=abc)+abc/aftertext abcabcabc \= Expect no match xyz /(?=abc)++abc/aftertext abcabcabc \= Expect no match xyz /(?=abc){0}xyz/ xyz /(?=abc){1}xyz/ \= Expect no match xyz /(?=(a))?./ ab bc /(?=(a))??./ ab bc /^(?=(a)){0}b(?1)/ backgammon /^(?=(?1))?[az]([abc])d/ abd zcdxx /^(?!a){0}\w+/ aaaaa /(?<=(abc))?xyz/ abcxyz pqrxyz /((?2))((?1))/ abc /(?(R)a+|(?R)b)/ aaaabcde /(?(R)a+|((?R))b)/ aaaabcde /((?(R)a+|(?1)b))/ aaaabcde /((?(R2)a+|(?1)b))()/ aaaabcde /(?(R)a*(?1)|((?R))b)/ aaaabcde /(a+)/no_auto_possess aaaa\=ovector=3 aaaa\=ovector=4 /^\R/ \r\=ps \r\=ph /^\R{2,3}x/ \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph \r\rx \r\r\rx /^\R{2,3}?x/ \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph \r\rx \r\r\rx /^\R?x/ \r\=ps \r\=ph x \rx /^\R+x/ \r\=ps \r\=ph \r\n\=ps \r\n\=ph \rx /^a$/newline=crlf a\r\=ps a\r\=ph /^a$/m,newline=crlf a\r\=ps a\r\=ph /^(a$|a\r)/newline=crlf a\r\=ps a\r\=ph /^(a$|a\r)/m,newline=crlf a\r\=ps a\r\=ph /./newline=crlf \r\=ps \r\=ph /.{2,3}/newline=crlf \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph /.{2,3}?/newline=crlf \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph # Test simple validity check for restarts /abcdef/ abc\=dfa_restart /)(.)|(?R))++)*F>/ text text xxxxx text F> text2 more text. /^(?>.{4})abc|^\w\w.xabcd/ xxxxabcd xx\xa0xabcd /^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/ xxxxxxxxabcd xx\xa0xxxxxabcd /abcd/ abcd\=ovector=0 # These tests show up auto-possessification /[ab]*/ aaaa /[ab]*?/ aaaa /[ab]?/ aaaa /[ab]??/ aaaa /[ab]+/ aaaa /[ab]+?/ aaaa /[ab]{2,3}/ aaaa /[ab]{2,3}?/ aaaa /[ab]{2,}/ aaaa /[ab]{2,}?/ aaaa '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED /abc(?=xyz)/allusedtext abcxyzpqr abcxyzpqr\=aftertext /(?<=pqr)abc(?=xyz)/allusedtext xyzpqrabcxyzpqr xyzpqrabcxyzpqr\=aftertext /a\b/ a.\=allusedtext a\=allusedtext /abc(?=abcde)(?=ab)/allusedtext abcabcdefg /a*?b*?/ ab /(*NOTEMPTY)a*?b*?/ ab ba cb /(*NOTEMPTY_ATSTART)a*?b*?/aftertext ab cdab /(a)(b)|(c)/ XcX\=ovector=2,get=1,get=2,get=3,get=4,getall /(?aa)/ aa\=get=A aa\=copy=A /a+/no_auto_possess a\=ovector=2,get=1,get=2,getall aaa\=ovector=2,get=1,get=2,getall /a(b)c(d)/ abc\=ph,copy=0,copy=1,getall /ab(?C" any text with spaces ")cde/B abcde 12abcde /^a(b)c(?C1)def/ abcdef /^a(b)c(?C"AB")def/ abcdef /^a(b)c(?C1)def/ abcdef\=callout_capture /^a(b)c(?C{AB})def/B abcdef\=callout_capture /^(?(?C25)(?=abc)abcd|xyz)/B abcdefg xyz123 /^(?(?C$abc$)(?=abc)abcd|xyz)/B abcdefg xyz123 /^ab(?C'first')cd(?C"second")ef/ abcdefg /(?:a(?C`code`)){3}X/ aaaXY # Binary zero in callout string /"a(?C'x" 00 "z')b"/hex abcdefgh /(?(?!)a|b)/ bbb \= Expect no match aaa /^/gm \n\n\n /^/gm,alt_circumflex \n\n\n /abc/use_offset_limit 1234abcde\=offset_limit=100 1234abcde\=offset_limit=9 1234abcde\=offset_limit=4 1234abcde\=offset_limit=4,offset=4 \= Expect no match 1234abcde\=offset_limit=4,offset=5 1234abcde\=offset_limit=3 /(?<=abc)/use_offset_limit 1234abc\=offset_limit=7 \= Expect no match 1234abc\=offset_limit=6 /abcd/null_context abcd\=null_context /()()a+/no_auto_possess aaa\=allcaptures a\=allcaptures /(*LIMIT_DEPTH=100)^((.)(?1)|.)$/ \= Expect depth limit exceeded a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00] /(*LIMIT_HEAP=0)^((.)(?1)|.)$/ \= Expect heap limit exceeded a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00] /(*LIMIT_HEAP=50000)^((.)(?1)|.)$/ \= Expect success a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00] /(02-)?[0-9]{3}-[0-9]{3}/ 02-123-123 /^(a(?2))(b)(?1)/ abbab\=find_limits /abc/endanchored xyzabc \= Expect no match xyzabcdef \= Expect error xyzabc\=ph /abc/ xyzabc\=endanchored \= Expect no match xyzabcdef\=endanchored \= Expect error xyzabc\=ps,endanchored /abc|bcd/endanchored xyzabcd \= Expect no match xyzabcdef /(*NUL)^.*/ a\nb\x00ccc /(*NUL)^.*/s a\nb\x00ccc /^x/m,newline=nul ab\x00xy /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex x\nyz /(*NUL)^X\NY/ X\nY X\rY \= Expect no match X\x00Y /(?<=abc|)/ abcde\=aftertext /(?<=|abc)/ abcde\=aftertext /(?<=abc|)/endanchored abcde\=aftertext /(?<=|abc)/endanchored abcde\=aftertext /(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor \= Expect limit exceeded .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?);); /\n/firstline xyz\nabc /\nabc/firstline xyz\nabc /\x{0a}abc/firstline,newline=crlf \= Expect no match xyz\r\nabc /[abc]/firstline \= Expect no match \na /foobar/ the foobar thing\=copy_matched_subject the foobar thing\=copy_matched_subject,zero_terminate /foobar/g the foobar thing foobar again\=copy_matched_subject /(?(VERSION>=0)^B0W)/ B0W-W0W \= Expect no match 0 /(?(VERSION>=1000)^B0W|W0W)/ B0W-W0W \= Expect no match 0 /(?<=pqr)abc(?=xyz)/ 123pqrabcxy\=ps,allusedtext 123pqrabcxyz\=ps,allusedtext /(?>a+b)/ aaaa\=ps aaaab\=ps /(abc)(?1)/ abca\=ps abcabc\=ps /(?(?=abc).*|Z)/ ab\=ps abcxyz\=ps /(abc)++x/ abcab\=ps abc\=ps ab\=ps abcx # End of testinput6