std.regexp vs std.regex [Re: RegExp.find() now crippled]

KennyTM~ kennytm at gmail.com
Mon Nov 15 04:48:36 PST 2010


On Nov 15, 10 14:58, Steve Teale wrote:
> Some time ago in phobos2, the following:
>
>     RegExp wsr = RegExp("(\\s+)");
>     int p = wsr.find("<thingie att1=\"whatever\">");
>     writefln("%s|%s|%s %d",wsr.pre(),  wsr.match(1), wsr.post(), p);
>
> would print:
>
> <thingie| |att1="whatever">  7
>
> Now it prints
>
> <thingie| |att1="whatever">  1
>
> The new return value is pretty useless, equivalent to returning a bool. It seems to me that the 'find' verb's subject should be the string, not the RegExp object.
>
> This looks like a case of the implementation being changed to match the documentation, when in fact it would have been better to change the documentation to match the implementation.
>
> Either that, or RegExp should have an indexOf method that behaves like string.indexOf.
>
> Steve
>

Isn't std.regexp replaced by std.regex? Why are both of them still in 
Phobos 2?

(oh, and std.regex is missing a documented .index (= .src_start) property.)


More information about the Digitalmars-d mailing list