jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I would like to match a part of a string with an other string. The problem that the string between the // contains regexp characters, like (, ) or [ etc<RB> Is there a way to escape this, for example like is done with html with escapeHTML() ?

Thanks in advance
Luca

Replies are listed 'Best First'.
Re: escape regexp
by tirwhan (Abbot) on Dec 19, 2005 at 13:33 UTC
    perldoc -f quotemeta

    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
Re: escape regexp
by john_oshea (Priest) on Dec 19, 2005 at 13:27 UTC

    From perlre:

    \Q          quote (disable) pattern metacharacters till \E
Re: escape regexp
by salva (Canon) on Dec 19, 2005 at 13:34 UTC
    perldoc -f quotemeta