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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 20 03:06:40 PST 2012


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

           Summary: Regex parsing bug for right bracket in character class
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: magnus at hetland.org


--- Comment #0 from Magnus Lie Hetland <magnus at hetland.org> 2012-02-20 03:06:36 PST ---
It seems that a bug has appeared for charsets in the std.regex. In previous
versions, a right bracket could be included in a character set by placing it
first, as is the case in many other languages/libraries. In the current version
(I'm using the canned DMD 2.058 for OS X), that doesn't work:

import std.regex;
void main() {
    auto r = regex("[]]");
}

This gives the following exception:

std.regex.RegexException@/usr/share/dmd/src/phobos/std/regex.d(1951): wrong
CodepointSet
Pattern with error: `[]` <--HERE-- `]`

This should probably be permitted, as a "least surprise" practice, and to
preserve compatibility with older versions. (It doesn't seem to be explicitly
documented in the standard library docs, though. Then again, as far as I can
see, no other mechanism for including right brackets in charsets is documented
either.)

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