Help for this page

Select Code to Download


  1. or download this
    # first one
    my ($start, $middle, undef, $end) = $string =~ /^(.*?)(($pattern)+)(.*
    +?)$/g;
    
    # second one, with non-capturing parens -- I like it better
    my ($start,$middle,$end) = $string =~ /^(.*?)((?:$pattern)+)(.*?)$/g;
    
  2. or download this
    $pattern = 'AB';
    'BABABABBB' =~
    ...
    print "$1<$2>$3$/";
    __END__
    prints "B<ABABAB>BB"