Help for this page

Select Code to Download


  1. or download this
    my $str = "This is one thing. This.";
    
    ...
    my $cref = sub { $_[0] =~ s/This/That/ig; };
    
    cref_regex($str, $cref);
    
  2. or download this
    sub separate_regex {
        my ($str, $search, $replace) = @_;
    ...
    }
    
    separate_regex($str, 'This', 'That');