Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Perl Regular Expression inconsistency

by japhy (Canon)
on Mar 14, 2006 at 13:31 UTC ( [id://536570]=note: print w/replies, xml ) Need Help??


in reply to Perl Regular Expression inconsistency

The only time '{' needs to be escaped is when it is followed by a set of digits, followed by an optional comma and more digits, followed by a closing '}'. If you don't want that sequence of characters to be interpreted as a quantifier, all you need to do is escape the leading '{'. (This is ignoring places where {...} is part of an escaped expression like \p{Xyz} and \N{CHARACTER}.)

'{' is only a metacharacter in a very specific circumstance. You almost never need to backslash it in a regex.


Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found