in reply to Regular Expressions: Call for Examples
It's a relatively simple one, but it opened my eyes, as a beginner, to a whole world of nested and executing regexes.
I'm reproducing it here from memory so merlyn will forgive me if it's not quite how he did it:
$str= 'no change <these spaces need replacing> not these <these do>'; $str =~ s{(<[^>]*?>)} { my $x=$1; $x=~s/ /_/g; $x; }egx; print $str
And the other one I can't remember at all, but I remember it involved Old MacDonald, and a regex that double-executed, and therefore ended "/eieio". Has to be included.
--
($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expressions: Call for Examples
by footpad (Abbot) on Jul 23, 2002 at 22:11 UTC |