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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 03:18:56 PST 2012


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



--- Comment #5 from Magnus Lie Hetland <magnus at hetland.org> 2012-02-27 03:18:50 PST ---
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…?-)

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 ;-)

-- 
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