Help for this page

Select Code to Download


  1. or download this
    $regex = ['foo','bar'];
    $string = 'blah foo blah';
    $string =~ s/$regex->[0]/$regex->[1]/;
    
  2. or download this
    $regex = ['(foo)','bar$1'];
    $string = 'blah foo blah';
    $string =~ s/$regex->[0]/$regex->[1]/;