Is str ~ regex the root of all evil, or the leaf of all good?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Feb 19 12:09:53 PST 2009


jovo wrote:
> "Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
> news:gnkc24$hul$1 at digitalmars.com...
>> The consecrated terminology is:
>>
>> foreach(match; match(s, r))
>>    foreach(capture; match)
>>      writeln(capture);
>>
>> "Group" is a group defined without an intent to capture. A "capture" is a 
>> group that also binds to the state of the match.
>>
>> Anyhow... this can be done but things get a tad more confusing for other 
>> uses. How about this:
>>
>> foreach(match; match(s, r))
>>    foreach(capture; match.captures)
>>      writeln(capture);
>>
>> ?
>>
>>
>> Andrei
> 
> 
> I think you must answer this question more generally, same for all library.
> May be both?

I'd hate to fall again into the fallacy of trying to appease everyone's 
taste. Really std.regexp has set a negative record with the incredible 
array of names: find, search, exec, match, test, and probably I forgot a 
couple. Also it has offered a variety of random features in both 
free-function and member-function format, not even always doing the same 
thing. Germans have a saying: "Kurtz und gut". Let's make it short and good.

Andrei



More information about the Digitalmars-d mailing list