Help for this page

Select Code to Download


  1. or download this
    >perl -wMstrict -le
    "my $s = 'x(y) (a(b)) ()() q (a(b)c()(d(e(f)g))h) q';
    ...
    
    final regex:
    (?^msx: ((?^msx: \( ([^()]* | (??{ our $rx }))* \) )) [^()]* ((?^msx: 
    +\( ([^()]* | (??{ our $rx }))* \) )) )
    
  2. or download this
    
    counted capture groups:
    ...
    (?^msx: ((?^msx: \( ([^()]* | (??{ our $rx }))* \) )) [^()]* ((?^msx: 
    +\( ([^()]* | (??{ our $rx }))* \) )) )
            |           |                        |      |        |        
    +   |                        |      |
            1st begin   2nd begin                2-end  1st end  3rd begin
    +   4th begin                4-end  3rd end