D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7718 - regex and ctRegex produce different results
Summary: regex and ctRegex produce different results
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-16 09:01 UTC by Joshua Niehus
Modified: 2012-03-30 08:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Joshua Niehus 2012-03-16 09:01:21 UTC
The following snippet produce different matches when they should be the same.  

#!/usr/local/bin/rdmd
import std.stdio, std.regex;

void main() {
    string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'no timer'";

    auto ctre = ctRegex!(`(".*")|('.*')`, "g");
    auto   re =     regex (`(".*")|('.*')`, "g");

    auto ctm = match(strcmd, ctre);
    foreach(ct; ctm)
      writeln(ct.hit());

    auto m = match(strcmd, re);
    foreach(h; m)
      writeln(h.hit());
}
/* output */
"/GIT/Ruby Apps/sec"
'no timer'
"/GIT/Ruby Apps/sec"
Comment 1 Dmitry Olshansky 2012-03-30 08:36:29 UTC
https://github.com/D-Programming-Language/phobos/pull/462