Well, a convenient way to "remove" your \ possibly, and then re-add
them, off the top of my head is to use:

Split-map-join

Where you split on \, map your previous s/// on the results, and then
join with \\.

I'm assuming you want to preserve user \ values as literal chars.

-----Original Message-----
From: Bill Moseley [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 29, 2007 4:58 PM
To: CAMPBELL, BRIAN D (BRIAN)
Cc: dbi-users@perl.org
Subject: Re: escaping % AND \%

On Fri, Jun 29, 2007 at 03:03:42PM -0500, CAMPBELL, BRIAN D (BRIAN)
wrote:
> Then if you want all chars to be treated literally, then I presume you
> want:
>   \%
> To be translated to:
>   \\\%
> So just adding your $esc to the left part of s/// should do the trick,

> right?

The \\% is translated to:

    \\\\%

Which leaves the % unescaped.

I'll just remove "\" from the input.  But thought this might be a
reasonably common situation (use % around a search string but not allow
% or _ to be special in the user data.

--
Bill Moseley
[EMAIL PROTECTED]

Reply via email to