[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Problem matching on [.]
- From: Nick Gammon <nick@...>
- Date: Thu, 17 May 2007 09:22:38 +1000
On 16/05/2007, at 2:49 AM, Mark Edgar wrote:
In fact not even the backslash is not special in classical (BRE and
ERE) regexes when used in a bracket expression [].
I think it would be particularly helpful for the manual (and PiL) to
spell out the reduced (or altered) set of magic characters inside a
[ ... ] sequence.
There is an explicit list of magic characters outside the [ ... ]
sequence, but not inside. For example, does [[] match a left bracket?
(It appears it does).
A quick browse of the source would appear to indicate that inside the
[ ... ] sequence only the following characters are special:
] -- to end the class, unless preceded by %
% -- to introduce a character class, or magic character
^ -- in the first position only, to negate the class
- -- between two characters, to specify a range
- Nick