in reply to Re: Re: Regular expression question
in thread Regular expression question
#!/usr/bin/perl use strict; use warnings; undef $/; $_ = <DATA>; my %repl = qw / < < > > foo bar bar foo /; s/(<\s*br\s*>|[<>]|foo|bar)/$repl{$1}||$1/ge; print; __DATA__ <br> Don't do the regex < br > Don't do the regex < br> Don't do the regex <br > Don't do the regex <this> Do the regex <is> Do the regex <a> Do the regex <test> Do the regex <this is a test> Do the regex <br> Don't do the regex < br > Don't do the regex < br> Don't do the regex <br > Don't do the regex <this> Do the regex <is> Do the regex <a> Do the regex <test> Do the regex <this is a test> Do the regex
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular expression question
by TASdvlper (Monk) on Jan 16, 2004 at 19:16 UTC | |
by Abigail-II (Bishop) on Jan 16, 2004 at 20:17 UTC | |
by TASdvlper (Monk) on Jan 19, 2004 at 14:51 UTC |