in reply to Re: Problems with matching and metacharacters
in thread Problems with matching and metacharacters

Actually, the \E is not needed, since $input is the only thing in the regex; that is, it is automatically ended.
/(\Q$input)/
Here's a question: Why would you need to put parentheses around $input? You can access its value more efficiently as $input, than as $1, since parentheses would slow down the regex. More succintly, change the code to this:
/\Q$input/
And change occurences of $1 to $input

Replies are listed 'Best First'.
Re: Re: Re: Problems with matching and metacharacters
by WebHick (Scribe) on Jun 14, 2001 at 20:35 UTC

    Actually, /(\Q$input)/ produces the error:

    /(\(\)/: unmatched () in regexp

    because you're now matching $input), not just $input. If the parenthesis are to stay, you'll need the \E

    Sarah