Help for this page

Select Code to Download


  1. or download this
    $string = 'string with word foo in it';
    $string =~ s/(foo)/\1bar/g;
    
  2. or download this
    $string = 'string with word foo in it';
    $find = '(foo)';
    $replace = '\1bar';
    $string =~ s/$find/$replace/g;