|
From: Jonathan S. <gel...@ge...> - 2001-11-26 21:03:59
|
On Mon, 26 Nov 2001, Nick Cleaton wrote:
> On Mon, Nov 26, 2001 at 05:40:05AM -0800, Nick Cleaton wrote:
> >
> > Modified Files:
> > guestbook.pl
> > Log Message:
> > Added \Q \E around variables in regexps where metacharacters in the
> > variables shouldn't be interpreted by the regex engine.
>
> I propose this convention for interpolating variables into regular
> expressions:
>
> metacharacters interpreted: (?:$foo) or ($foo)
>
Was the first available in 5.00404 ? If so that should be the one of
choice :)
> metacharacters not interpreted: \Q$foo\E
>
Yep, but if the the contents of $foo are themselves constructing a regex
from some other construct then it should be taken back a step earlier:
my $pattern = join '|', map { quotemeta($_) } keys(%unescape_html_map);
As in recent wwwboard.pl ....
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
|