in reply to Re: Turn Hate Mail to Love Letter: Regex Multi-Word/Phase Replace
in thread Turn Hate Mail to Love Letter: Regex Multi-Word/Phase Replace
"me" is captured in $4. In other words, we don't know ahead of time which of the $1 .. $n "me" will end up in when the regex can have arbitrary many brackets.$_ = "candies lift me up"; s/(cand(y|ies)|lift(s|) (me|us) up)/1 $1; 2 $2; 3 $3; 4 $4;\n/g; print ; __END__ 1 candies; 2 ies; 3 ; 4 ; 1 lift me up; 2 ; 3 ; 4 me;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Turn Hate Mail to Love Letter: Regex Multi-Word/Phase Replace
by Skeeve (Parson) on Jun 26, 2003 at 06:22 UTC | |
by chunlou (Curate) on Jun 26, 2003 at 06:40 UTC | |
by Skeeve (Parson) on Jun 26, 2003 at 07:40 UTC | |
by chunlou (Curate) on Jun 26, 2003 at 10:20 UTC |