in reply to Re^2: Please help with Regexp::Common
in thread Please help with Regexp::Common
You might consider adding a test to check if the expected alteration to the original regex was successful. The \Q(?:\b\E and \Q\b)\E parts of the substitution are rather fragile IMO and may break if the maintainer(s) of Regexp::Common ever change his/her/their notion of what a proper profane regex should look like.
c:\@Work\Perl\monks>perl -wMstrict -le "use Regexp::Common; ;; (my $reg = $RE{profanity}) =~ s{\A \Q(?:\b\E (.*) \Q\b)\E \z}{$1}xms or die 'profanity anchor trim failed'; ;; print qq{bad: '$1'} if 'Matsushita' =~ m{ ($reg) }xms; " bad: 'shit'
Give a man a fish: <%-{-{-{-<
|
---|