#!/usr/bin/perl use strict; use warnings; undef $/; $_ = ; my %repl = qw / < < > > foo bar bar foo /; s/(<\s*br\s*>|[<>]|foo|bar)/$repl{$1}||$1/ge; print; __DATA__
Don't do the regex < br > Don't do the regex < br> Don't do the regex
Don't do the regex Do the regex Do the regex Do the regex Do the regex Do the regex
Don't do the regex < br > Don't do the regex < br> Don't do the regex
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