Help for this page

Select Code to Download


  1. or download this
    print $_, /(x(.*)x(??{ '.{'.length($2).'}' })x)/
        ? " matches, \$1 = $1\n" : " doesn't match\n"
    ...
    x123x.x.x matches, $1 = x123x.x.x
    x12x1x doesn't match
    ax1x2xbx34x56xc matches, $1 = x1x2xbx34x56x
    
  2. or download this
    my $re = qr/(x(.*?)x(??{ '.{'.length($2).'}' })x)/;
    my $str = "ax1x2xbx34x56xc";
    ...
    
    found "x1x2x"
    found "x34x56x"