[Issue 7551] Regex parsing bug for right bracket in character class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 05:18:14 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7551



--- Comment #6 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-02-27 05:18:12 PST ---
(In reply to comment #5)
> Quoting Dmitry:
> > BTW this page shows that [ and ] should be escaped, and not a single word on it
> > used as first character (unlike '-' that is supported).
> > http://www.php.net/manual/en/regexp.reference.character-classes.php
> 
> Huh? Did you read the first paragraph…?-)

Searching gets the better of me :( I 'greped' for "[" 

> 
> Quoted, for your convenience (my highlight):
> > An opening square bracket introduces a character class, terminated by a closing square
> > bracket. A closing square bracket on its own is not special. **If a closing square bracket is
> > required as a member of the class, it should be the first data character in the class** (after
> > an initial circumflex, if present) or escaped with a backslash.
> 
> It says so right there, no? This is the way it's been in several languages I've
> used throughout the years. I guess they just didn't have escaping inside
> character classes in the olden days ;-)

Apparently it's one of these historical kind of things.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list