regex issue

Joshua Niehus jm.niehus at gmail.com
Thu Mar 15 20:36:11 PDT 2012


Hello,

Does anyone know why I would get different results between
ctRegex and regex in the following snippet?

Thanks,
Josh

---
#!/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"


More information about the Digitalmars-d-learn mailing list