[Issue 9979] New: Regex bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 22 16:52:51 PDT 2013


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

           Summary: Regex bug
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: diggsey at googlemail.com


--- Comment #0 from Diggory <diggsey at googlemail.com> 2013-04-22 16:52:50 PDT ---
The following regular expression gives a zero length match for the last match
in the string:

regex(r"\b([a-zA-Z_][a-zA-Z_0-9]*)\b(\s*\([^)]*\))?", "g");

Example:
auto r = regex(r"\b([a-zA-Z_][a-zA-Z_0-9]*)\b(\s*\([^)]*\))?", "g");
string text = replace("A ? B : C", r, "0");
writeln(text);

Expected output:
"0 ? 0 : 0"

Actual output:
"0 ? 0 : 0C"

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