Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: efficient char escape sequence substitution

by nobull (Friar)
on May 28, 2005 at 07:51 UTC ( [id://461302]=note: print w/replies, xml ) Need Help??


in reply to Re: efficient char escape sequence substitution
in thread efficient char escape sequence substitution

That doesn't handle wide-character escapes.

In comp.lang.perl.misc I recently offered this solution.

s/(\\[^"\$\@]+)/qq("$1")/eeg;

Note that's not 100% infalible but AFAIK it's not a security problem and copes with all reasonable strings. It does have the interesting side effect of stripping \$ \" and \@ - but those have no buisness being in most of the sort of strings you'll encounter.

Replies are listed 'Best First'.
Re^3: efficient char escape sequence substitution
by Roy Johnson (Monsignor) on May 28, 2005 at 21:42 UTC
    How wide is a wide character escape? There's no reason that you can't change the quantifier in my regex to accommodate them. I just wasn't aware of any escapes wider than three characters.

    Caution: Contents may have been coded under pressure.
      I don't think there's a fixed maximum \N{WHITE SMILING FACE}.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://461302]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-18 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found