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

Re: [perlre] 4-digit hex code in regexp? How to specify?

by Mr. Muskrat (Canon)
on Nov 14, 2002 at 21:16 UTC ( [id://213017]=note: print w/replies, xml ) Need Help??


in reply to [perlre] 4-digit hex code in regexp? How to specify?

This works great until you try to put it into brackets...
s/(\x{0024})/$delimiter/gm;

Replies are listed 'Best First'.
Re: Re: [perlre] 4-digit hex code in regexp? How to specify?
by jreades (Friar) on Nov 14, 2002 at 21:43 UTC

    There appear to be two ways to handle hex codes -- one is the one that you are using:

    \x1B

    The other is the method used by Mr. Muskrat:

    \x{263a}

    If you're using 'wide' hex digits (as I assume is the case since you're talking about four digits in this example) then you probably need to use the \x{...} approach.

    If you'll tell us a little more about what you're doing, we might be able to move beyond a single substitution. Unless that's all you need, in which case this appears to work:

    s/\x{0024}/$delimiter/

    And you don't need to make it part of a character class

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found