regex issue

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Mar 16 01:34:14 PDT 2012


On 16.03.2012 7:36, Joshua Niehus wrote:
> Hello,
>
> Does anyone know why I would get different results between
> ctRegex and regex in the following snippet?

Ehm, because they have different engines that _should_ give identical 
results. And the default one apparently has a bug, that I'm looking into.
Fill the bug report plz.

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


-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list