Help for this page

Select Code to Download


  1. or download this
    $string =~ s/(\Q$first\E).*?(\Q$last\E)/$1$reserve$2/;
    
  2. or download this
    $string =~ s/(?<=\Q$first\E).*?(?=\Q$last\E)/$reserve/;
    
  3. or download this
    $first_start = index($_, $first);
    if ($first_start >= 0) {
    ...
          substr($_, $first_end, $last_start, $replace);
       }
    }