Please help on multiple match replacement

Posted by duenguyen on Stack Overflow See other posts from Stack Overflow or by duenguyen
Published on 2010-05-05T00:38:02Z Indexed on 2010/05/05 0:48 UTC
Read the original article Hit count: 229

Filed under:
|

I have a perl code:

my $s = "The+quick+brown+fox+jumps+over+the+lazy+dog+that+is+my+dog";

what I want is to replace every + with space and dog with cat

i have this regular expression

$s =~ s/+(.*)dog/ ${1}cat/g;

But it only match first occurrence of + and last dog.

Please help

© Stack Overflow or respective owner

Related posts about perl

Related posts about regex