/(?<!bar)foo/
    foo
    catfood
    arfootle
    rfoosh
    *** Failers
    barfoo
    towbarfoo

/\w{3}(?<!bar)foo/
    catfood
    *** Failers
    foo
    barfoo
    towbarfoo

/(?<=(foo)a)bar/
    fooabar
    *** Failers
    bar
    foobbar
      
/\Aabc\z/m
    abc
    *** Failers
    abc\n   
    qqq\nabc
    abc\nzzz
    qqq\nabc\nzzz

"(?>.*/)foo"
    /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
    *** Failers 
    1.235 

/^((?>\w+)|(?>\s+))*$/
    now is the time for all good men to come to the aid of the party
    *** Failers
    this is not a line with only words and spaces!
    
/(\d+)(\w)/
    12345a
    12345+ 

/((?>\d+))(\w)/
    12345a
    *** Failers
    12345+ 

/(?>a+)b/
    aaab

/((?>a+)b)/
    aaab

/(?>(a+))b/
    aaab

/(?>b)+/
    aaabbbccc

/(?>a+|b+|c+)*c/
    aaabbbbccccd

/((?>[^()]+)|\([^()]*\))+/
    ((abc(ade)ufh()()x
    
/\(((?>[^()]+)|\([^()]+\))+\)/ 
    (abc)
    (abc(def)xyz)
    *** Failers
    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   

/a(?-i)b/i
    ab
    *** Failers 
    Ab
    aB
    AB
        
/(a (?x)b c)d e/
    a bcd e
    *** Failers
    a b cd e
    abcd e   
    a bcde 
 
/(a b(?x)c d (?-x)e f)/
    a bcde f
    *** Failers
    abcdef  

/(a(?i)b)c/
    abc
    aBc
    *** Failers
    abC
    aBC  
    Abc
    ABc
    ABC
    AbC
    
/a(?i:b)c/
    abc
    aBc
    *** Failers 
    ABC
    abC
    aBC
    
/a(?i:b)*c/
    aBc
    aBBc
    *** Failers 
    aBC
    aBBC
    
/a(?=b(?i)c)\w\wd/
    abcd
    abCd
    *** Failers
    aBCd
    abcD     
    
/(?s-i:more.*than).*million/i
    more than million
    more than MILLION
    more \n than Million 
    *** Failers
    MORE THAN MILLION    
    more \n than \n million 

/(?:(?s-i)more.*than).*million/i
    more than million
    more than MILLION
    more \n than Million 
    *** Failers
    MORE THAN MILLION    
    more \n than \n million 
    
/(?>a(?i)b+)+c/ 
    abc
    aBbc
    aBBc 
    *** Failers
    Abc
    abAb    
    abbC 
    
/(?=a(?i)b)\w\wc/
    abc
    aBc
    *** Failers
    Ab 
    abC
    aBC     
    
/(?<=a(?i)b)(\w\w)c/
    abxxc
    aBxxc
    *** Failers
    Abxxc
    ABxxc
    abxxC      

/(?:(a)|b)(?(1)A|B)/
    aA
    bB
    *** Failers
    aB
    bA    

/^(a)?(?(1)a|b)+$/
    aa
    b
    bb  
    *** Failers
    ab   

/^(?(?=abc)\w{3}:|\d\d)$/
    abc:
    12
    *** Failers
    123
    xyz    

/^(?(?!abc)\d\d|\w{3}:)$/
    abc:
    12
    *** Failers
    123
    xyz    
    
/(?(?<=foo)bar|cat)/
    foobar
    cat
    fcat
    focat   
    *** Failers
    foocat  

/(?(?<!foo)cat|bar)/
    foobar
    cat
    fcat
    focat   
    *** Failers
    foocat  

/( \( )? [^()]+ (?(1) \) |) /x
    abcd
    (abcd)
    the quick (abcd) fox
    (abcd   

/( \( )? [^()]+ (?(1) \) ) /x
    abcd
    (abcd)
    the quick (abcd) fox
    (abcd   

/^(?(2)a|(1)(2))+$/
    12
    12a
    12aa
    *** Failers
    1234    

/((?i)blah)\s+\1/
    blah blah
    BLAH BLAH
    Blah Blah
    blaH blaH
    *** Failers
    blah BLAH
    Blah blah      
    blaH blah 

/((?i)blah)\s+(?i:\1)/
    blah blah
    BLAH BLAH
    Blah Blah
    blaH blaH
    blah BLAH
    Blah blah      
    blaH blah 

/(?>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
    *** Failers
    sep-12-98
        
/(?<=(foo))bar\1/
    foobarfoo
    foobarfootling 
    *** Failers
    foobar
    barfoo   

/(?i:saturday|sunday)/
    saturday
    sunday
    Saturday
    Sunday
    SATURDAY
    SUNDAY
    SunDay
    
/(a(?i)bc|BB)x/
    abcx
    aBCx
    bbx
    BBx
    *** Failers
    abcX
    aBCX
    bbX
    BBX               

/^([ab](?i)[cd]|[ef])/
    ac
    aC
    bD
    elephant
    Europe 
    frog
    France
    *** Failers
    Africa     

/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
    ab
    aBd
    xy
    xY
    zebra
    Zambesi
    *** Failers
    aCD  
    XY  

/(?<=foo\n)^bar/m
    foo\nbar
    *** Failers
    bar
    baz\nbar   

/(?<=(?<!foo)bar)baz/
    barbaz
    barbarbaz 
    koobarbaz 
    *** Failers
    baz
    foobarbaz 

/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
/where it does set $1 to aa when matching aaaaaa./

/^(a\1?){4}$/
    a
    aa
    aaa
    aaaa
    aaaaa
    aaaaaaa
    aaaaaaaa
    aaaaaaaaa
    aaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaaa
    aaaaaaaaaaaaa
    aaaaaaaaaaaaaa
    aaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa               

/^(a\1?)(a\1?)(a\2?)(a\3?)$/
    a
    aa
    aaa
    aaaa
    aaaaa
    aaaaaa
    aaaaaaa
    aaaaaaaa
    aaaaaaaaa
    aaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaaa
    aaaaaaaaaaaaa
    aaaaaaaaaaaaaa
    aaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa               

/The following tests are taken from the Perl 5.005 test suite; some of them/
/are compatible with 5.004, but I'd rather not have to sort them out./

/abc/
    abc
    xabcy
    ababc
    *** Failers
    xbc
    axc
    abx

/ab*c/
    abc

/ab*bc/
    abc
    abbc
    abbbbc

/.{1}/
    abbbbc

/.{3,4}/
    abbbbc

/ab{0,}bc/
    abbbbc

/ab+bc/
    abbc
    *** Failers
    abc
    abq

/ab{1,}bc/

/ab+bc/
    abbbbc

/ab{1,}bc/
    abbbbc

/ab{1,3}bc/
    abbbbc

/ab{3,4}bc/
    abbbbc

/ab{4,5}bc/
    *** Failers
    abq
    abbbbc

/ab?bc/
    abbc
    abc

/ab{0,1}bc/
    abc

/ab?bc/

/ab?c/
    abc

/ab{0,1}c/
    abc

/^abc$/
    abc
    *** Failers
    abbbbc
    abcc

/^abc/
    abcc

/^abc$/

/abc$/
    aabc
    *** Failers
    aabc
    aabcd

/^/
    abc

/$/
    abc

/a.c/
    abc
    axc

/a.*c/
    axyzc

/a[bc]d/
    abd
    *** Failers
    axyzd
    abc

/a[b-d]e/
    ace

/a[b-d]/
    aac

/a[-b]/
    a-

/a[b-]/
    a-

/a]/
    a]

/a[]]b/
    a]b

/a[^bc]d/
    aed
    *** Failers
    abd
    abd

/a[^-b]c/
    adc

/a[^]b]c/
    adc
    *** Failers
    a-c
    a]c

/\ba\b/
    a-
    -a
    -a-

/\by\b/
    *** Failers
    xy
    yz
    xyz

/\Ba\B/
    *** Failers
    a-
    -a
    -a-

/\By\b/
    xy

/\by\B/
    yz

/\By\B/
    xyz

/\w/
    a

/\W/
    -
    *** Failers
    -
    a

/a\sb/
    a b

/a\Sb/
    a-b
    *** Failers
    a-b
    a b

/\d/
    1

/\D/
    -
    *** Failers
    -
    1

/[\w]/
    a

/[\W]/
    -
    *** Failers
    -
    a

/a[\s]b/
    a b

/a[\S]b/
    a-b
    *** Failers
    a-b
    a b

/[\d]/
    1

/[\D]/
    -
    *** Failers
    -
    1

/ab|cd/
    abc
    abcd

/()ef/
    def

/$b/

/a\(b/
    a(b

/a\(*b/
    ab
    a((b

/a\\b/
    a\b

/((a))/
    abc

/(a)b(c)/
    abc

/a+b+c/
    aabbabc

/a{1,}b{1,}c/
    aabbabc

/a.+?c/
    abcabc

/(a+|b)*/
    ab

/(a+|b){0,}/
    ab

/(a+|b)+/
    ab

/(a+|b){1,}/
    ab

/(a+|b)?/
    ab

/(a+|b){0,1}/
    ab

/[^ab]*/
    cde

/abc/
    *** Failers
    b
    

/a*/
    

/([abc])*d/
    abbbcd

/([abc])*bcd/
    abcd

/a|b|c|d|e/
    e

/(a|b|c|d|e)f/
    ef

/abcd*efg/
    abcdefg

/ab*/
    xabyabbbz
    xayabbbz

/(ab|cd)e/
    abcde

/[abhgefdc]ij/
    hij

/^(ab|cd)e/

/(abc|)ef/
    abcdef

/(a|b)c*d/
    abcd

/(ab|ab*)bc/
    abc

/a([bc]*)c*/
    abc

/a([bc]*)(c*d)/
    abcd

/a([bc]+)(c*d)/
    abcd

/a([bc]*)(c+d)/
    abcd

/a[bcd]*dcdcde/
    adcdcde

/a[bcd]+dcdcde/
    *** Failers
    abcde
    adcdcde

/(ab|a)b*c/
    abc

/((a)(b)c)(d)/
    abcd

/[a-zA-Z_][a-zA-Z0-9_]*/
    alpha

/^a(bc+|b[eh])g|.h$/
    abh

/(bc+d$|ef*g.|h?i(j|k))/
    effgz
    ij
    reffgz
    *** Failers
    effg
    bcdd

/((((((((((a))))))))))/
    a

/((((((((((a))))))))))\10/
    aa

/(((((((((a)))))))))/
    a

/multiple words of text/
    *** Failers
    aa
    uh-uh

/multiple words/
    multiple words, yeah

/(.*)c(.*)/
    abcde

/\((.*), (.*)\)/
    (a, b)

/[k]/

/abcd/
    abcd

/a(bc)d/
    abcd

/a[-]?c/
    ac

/(abc)\1/
    abcabc

/([a-c]*)\1/
    abcabc

/(a)|\1/
    a
    *** Failers
    ab
    x

/(([a-c])b*?\2)*/
    ababbbcbc

/(([a-c])b*?\2){3}/
    ababbbcbc

/((\3|b)\2(a)x)+/
    aaaxabaxbaaxbbax

/((\3|b)\2(a)){2,}/
    bbaababbabaaaaabbaaaabba

/abc/i
    ABC
    XABCY
    ABABC
    *** Failers
    aaxabxbaxbbx
    XBC
    AXC
    ABX

/ab*c/i
    ABC

/ab*bc/i
    ABC
    ABBC

/ab*?bc/i
    ABBBBC

/ab{0,}?bc/i
    ABBBBC

/ab+?bc/i
    ABBC

/ab+bc/i
    *** Failers
    ABC
    ABQ

/ab{1,}bc/i

/ab+bc/i
    ABBBBC

/ab{1,}?bc/i
    ABBBBC

/ab{1,3}?bc/i
    ABBBBC

/ab{3,4}?bc/i
    ABBBBC

/ab{4,5}?bc/i
    *** Failers
    ABQ
    ABBBBC

/ab??bc/i
    ABBC
    ABC

/ab{0,1}?bc/i
    ABC

/ab??bc/i

/ab??c/i
    ABC

/ab{0,1}?c/i
    ABC

/^abc$/i
    ABC
    *** Failers
    ABBBBC
    ABCC

/^abc/i
    ABCC

/^abc$/i

/abc$/i
    AABC

/^/i
    ABC

/$/i
    ABC

/a.c/i
    ABC
    AXC

/a.*?c/i
    AXYZC

/a.*c/i
    *** Failers
    AABC
    AXYZD

/a[bc]d/i
    ABD

/a[b-d]e/i
    ACE
    *** Failers
    ABC
    ABD

/a[b-d]/i
    AAC

/a[-b]/i
    A-

/a[b-]/i
    A-

/a]/i
    A]

/a[]]b/i
    A]B

/a[^bc]d/i
    AED

/a[^-b]c/i
    ADC
    *** Failers
    ABD
    A-C

/a[^]b]c/i
    ADC

/ab|cd/i
    ABC
    ABCD

/()ef/i
    DEF

/$b/i
    *** Failers
    A]C
    B

/a\(b/i
    A(B

/a\(*b/i
    AB
    A((B

/a\\b/i
    A\B

/((a))/i
    ABC

/(a)b(c)/i
    ABC

/a+b+c/i
    AABBABC

/a{1,}b{1,}c/i
    AABBABC

/a.+?c/i
    ABCABC

/a.*?c/i
    ABCABC

/a.{0,5}?c/i
    ABCABC

/(a+|b)*/i
    AB

/(a+|b){0,}/i
    AB

/(a+|b)+/i
    AB

/(a+|b){1,}/i
    AB

/(a+|b)?/i
    AB

/(a+|b){0,1}/i
    AB

/(a+|b){0,1}?/i
    AB

/[^ab]*/i
    CDE

/abc/i

/a*/i
    

/([abc])*d/i
    ABBBCD

/([abc])*bcd/i
    ABCD

/a|b|c|d|e/i
    E

/(a|b|c|d|e)f/i
    EF

/abcd*efg/i
    ABCDEFG

/ab*/i
    XABYABBBZ
    XAYABBBZ

/(ab|cd)e/i
    ABCDE

/[abhgefdc]ij/i
    HIJ

/^(ab|cd)e/i
    ABCDE

/(abc|)ef/i
    ABCDEF

/(a|b)c*d/i
    ABCD

/(ab|ab*)bc/i
    ABC

/a([bc]*)c*/i
    ABC

/a([bc]*)(c*d)/i
    ABCD

/a([bc]+)(c*d)/i
    ABCD

/a([bc]*)(c+d)/i
    ABCD

/a[bcd]*dcdcde/i
    ADCDCDE

/a[bcd]+dcdcde/i

/(ab|a)b*c/i
    ABC

/((a)(b)c)(d)/i
    ABCD

/[a-zA-Z_][a-zA-Z0-9_]*/i
    ALPHA

/^a(bc+|b[eh])g|.h$/i
    ABH

/(bc+d$|ef*g.|h?i(j|k))/i
    EFFGZ
    IJ
    REFFGZ
    *** Failers
    ADCDCDE
    EFFG
    BCDD

/((((((((((a))))))))))/i
    A

/((((((((((a))))))))))\10/i
    AA

/(((((((((a)))))))))/i
    A

/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
    A

/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
    C

/multiple words of text/i
    *** Failers
    AA
    UH-UH

/multiple words/i
    MULTIPLE WORDS, YEAH

/(.*)c(.*)/i
    ABCDE

/\((.*), (.*)\)/i
    (A, B)

/[k]/i

/abcd/i
    ABCD

/a(bc)d/i
    ABCD

/a[-]?c/i
    AC

/(abc)\1/i
    ABCABC

/([a-c]*)\1/i
    ABCABC

/a(?!b)./
    abad

/a(?=d)./
    abad

/a(?=c|d)./
    abad

/a(?:b|c|d)(.)/
    ace

/a(?:b|c|d)*(.)/
    ace

/a(?:b|c|d)+?(.)/
    ace
    acdbcdbe

/a(?:b|c|d)+(.)/
    acdbcdbe

/a(?:b|c|d){2}(.)/
    acdbcdbe

/a(?:b|c|d){4,5}(.)/
    acdbcdbe

/a(?:b|c|d){4,5}?(.)/
    acdbcdbe

/((foo)|(bar))*/
    foobar

/a(?:b|c|d){6,7}(.)/
    acdbcdbe

/a(?:b|c|d){6,7}?(.)/
    acdbcdbe

/a(?:b|c|d){5,6}(.)/
    acdbcdbe

/a(?:b|c|d){5,6}?(.)/
    acdbcdbe

/a(?:b|c|d){5,7}(.)/
    acdbcdbe

/a(?:b|c|d){5,7}?(.)/
    acdbcdbe

/a(?:b|(c|e){1,2}?|d)+?(.)/
    ace

/^(.+)?B/
    AB

/^([^a-z])|(\^)$/
    .

/^[<>]&/
    <&OUT

/^(a\1?){4}$/
    aaaaaaaaaa
    *** Failers
    AB
    aaaaaaaaa
    aaaaaaaaaaa

/^(a(?(1)\1)){4}$/
    aaaaaaaaaa
    *** Failers
    aaaaaaaaa
    aaaaaaaaaaa

/(?:(f)(o)(o)|(b)(a)(r))*/
    foobar

/(?<=a)b/
    ab
    *** Failers
    cb
    b

/(?<!c)b/
    ab
    b
    b

/(?:..)*a/
    aba

/(?:..)*?a/
    aba

/^(?:b|a(?=(.)))*\1/
    abc

/^(){3,5}/
    abc

/^(a+)*ax/
    aax

/^((a|b)+)*ax/
    aax

/^((a|bc)+)*ax/
    aax

/(a|x)*ab/
    cab

/(a)*ab/
    cab

/(?:(?i)a)b/
    ab

/((?i)a)b/
    ab

/(?:(?i)a)b/
    Ab

/((?i)a)b/
    Ab

/(?:(?i)a)b/
    *** Failers
    cb
    aB

/((?i)a)b/

/(?i:a)b/
    ab

/((?i:a))b/
    ab

/(?i:a)b/
    Ab

/((?i:a))b/
    Ab

/(?i:a)b/
    *** Failers
    aB
    aB

/((?i:a))b/

/(?:(?-i)a)b/i
    ab

/((?-i)a)b/i
    ab

/(?:(?-i)a)b/i
    aB

/((?-i)a)b/i
    aB

/(?:(?-i)a)b/i
    *** Failers
    aB
    Ab

/((?-i)a)b/i

/(?:(?-i)a)b/i
    aB

/((?-i)a)b/i
    aB

/(?:(?-i)a)b/i
    *** Failers
    Ab
    AB

/((?-i)a)b/i

/(?-i:a)b/i
    ab

/((?-i:a))b/i
    ab

/(?-i:a)b/i
    aB

/((?-i:a))b/i
    aB

/(?-i:a)b/i
    *** Failers
    AB
    Ab

/((?-i:a))b/i

/(?-i:a)b/i
    aB

/((?-i:a))b/i
    aB

/(?-i:a)b/i
    *** Failers
    Ab
    AB

/((?-i:a))b/i

/((?-i:a.))b/i
    *** Failers
    AB
    a\nB

/((?s-i:a.))b/i
    a\nB

/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
    cabbbb

/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

/(ab)\d\1/i
    Ab4ab
    ab4Ab

/foo\w*\d{4}baz/
    foobar1234baz

/x(~~)*(?:(?:F)?)?/
    x~~

/^a(?#xxx){3}c/
    aaac

/^a (?#xxx) (?#yyy) {3}c/x
    aaac

/(?<![cd])b/
    *** Failers
    B\nB
    dbcb

/(?<![cd])[ab]/
    dbaacb

/(?<!(c|d))b/

/(?<!(c|d))[ab]/
    dbaacb

/(?<!cd)[ab]/
    cdaccb

/^(?:a?b?)*$/
    *** Failers
    dbcb
    a--

/((?s)^a(.))((?m)^b$)/
    a\nb\nc\n

/((?m)^b$)/
    a\nb\nc\n

/(?m)^b/
    a\nb\n

/(?m)^(b)/
    a\nb\n

/((?m)^b)/
    a\nb\n

/\n((?m)^b)/
    a\nb\n

/((?s).)c(?!.)/
    a\nb\nc\n
    a\nb\nc\n

/((?s)b.)c(?!.)/
    a\nb\nc\n
    a\nb\nc\n

/^b/

/()^b/
    *** Failers
    a\nb\nc\n
    a\nb\nc\n

/((?m)^b)/
    a\nb\nc\n

/(?(1)a|b)/

/(?(1)b|a)/
    a

/(x)?(?(1)a|b)/
    *** Failers
    a
    a

/(x)?(?(1)b|a)/
    a

/()?(?(1)b|a)/
    a

/()(?(1)b|a)/

/()?(?(1)a|b)/
    a

/^(\()?blah(?(1)(\)))$/
    (blah)
    blah
    *** Failers
    a
    blah)
    (blah

/^(\(+)?blah(?(1)(\)))$/
    (blah)
    blah
    *** Failers
    blah)
    (blah

/(?(?!a)a|b)/

/(?(?!a)b|a)/
    a

/(?(?=a)b|a)/
    *** Failers
    a
    a

/(?(?=a)a|b)/
    a

/(?=(a+?))(\1ab)/
    aaab

/^(?=(a+?))\1ab/

/(\w+:)+/
    one:

/$(?<=^(a))/
    a

/(?=(a+?))(\1ab)/
    aaab

/^(?=(a+?))\1ab/
    *** Failers
    aaab
    aaab

/([\w:]+::)?(\w+)$/
    abcd
    xy:z:::abcd

/^[^bcd]*(c+)/
    aexycd

/(a*)b+/
    caab

/([\w:]+::)?(\w+)$/
    abcd
    xy:z:::abcd
    *** Failers
    abcd:
    abcd:

/^[^bcd]*(c+)/
    aexycd

/(>a+)ab/

/(?>a+)b/
    aaab

/([[:]+)/
    a:[b]:

/([[=]+)/
    a=[b]=

/([[.]+)/
    a.[b].

/((?>a+)b)/
    aaab

/(?>(a+))b/
    aaab

/((?>[^()]+)|\([^()]*\))+/
    ((abc(ade)ufh()()x

/a\Z/
    *** Failers
    aaab
    a\nb\n

/b\Z/
    a\nb\n

/b\z/

/b\Z/
    a\nb

/b\z/
    a\nb
    *** Failers
    
/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
    a
    abc
    a-b
    0-9 
    a.b
    5.6.7  
    the.quick.brown.fox
    a100.b200.300c  
    12-ab.1245 
    ***Failers
    \
    .a
    -a
    a-
    a.  
    a_b 
    a.-
    a..  
    ab..bc 
    the.quick.brown.fox-
    the.quick.brown.fox.
    the.quick.brown.fox_
    the.quick.brown.fox+       

/(?>.*)(?<=(abcd|wxyz))/
    alphabetabcd
    endingwxyz
    *** Failers
    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
    word cat dog elephant mussel cow horse canary baboon snake shark
  
/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
    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 
    *** Failers
    123abcfoo
    
/(?<=(?!...999)\d{3})foo/
    999foo
    123999foo 
    *** Failers
    123abcfoo

/(?<=\d{3}(?!999)...)foo/
    123abcfoo
    123456foo 
    *** Failers
    123999foo  
    
/(?<=\d{3}...)(?<!999)foo/
    123abcfoo   
    123456foo 
    *** Failers
    123999foo  

/<a[\s]+href[\s]*=[\s]*          # find <a href=
 ([\"\'])?                       # find single or double quote
 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
                                 # quote, otherwise match up to next space
/isx
    <a href=abcd xyz
    <a href=\"abcd xyz pqr\" cats
    <a href=\'abcd xyz pqr\' cats

/<a\s+href\s*=\s*                # find <a href=
 (["'])?                         # find single or double quote
 (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
                                 # quote, otherwise match up to next space
/isx
    <a href=abcd xyz
    <a href=\"abcd xyz pqr\" cats
    <a href       =       \'abcd xyz pqr\' cats

/<a\s+href(?>\s*)=(?>\s*)        # find <a href=
 (["'])?                         # find single or double quote
 (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
                                 # quote, otherwise match up to next space
/isx
    <a href=abcd xyz
    <a href=\"abcd xyz pqr\" cats
    <a href       =       \'abcd xyz pqr\' cats

/((Z)+|A)*/
    ZABCDEFG

/(Z()|A)*/
    ZABCDEFG

/(Z(())|A)*/
    ZABCDEFG

/((?>Z)+|A)*/
    ZABCDEFG

/((?>)+|A)*/
    ZABCDEFG

/a*/g
    abbab

/^[a-\d]/
    abcde
    -things
    0digit
    *** Failers
    bcdef    

/^[\d-a]/
    abcde
    -things
    0digit
    *** Failers
    bcdef    

/ End of testinput3 /       
