No such thing as a small change | |
PerlMonks |
Re: Perl Regular Expression inconsistencyby japhy (Canon) |
on Mar 14, 2006 at 13:31 UTC ( [id://536570]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|