Help for this page

Select Code to Download


  1. or download this
    my $text = "Here is some text.";
    my $insert = "boring ";
    $text =~ s/(some\s)/$1$insert/;
    
  2. or download this
    my $text = "Here is some\nmulti-lined text";
    my $insert = "thrilling "
    $text =~ s/(some\s)/$1$insert/s;
    
  3. or download this
    $text =~ s/(some\s)/$1$insert/sg;
    
  4. or download this
    my $pattern = "Text with\nnewlines in it";
    my $text = ......lots of stuff.....
    $text =~ s/(\Q$pattern\E)/$1$insert/sg;