Is str ~ regex the root of all evil, or the leaf of all good?
BCS
ao at pathlink.com
Thu Feb 19 09:22:42 PST 2009
Reply to bearophile,
> Michel Fortin:
>
>> foreach(e; "co" in "conoco")
>> writeln(e);
>> should work too.
> Of course :-) I think eventually it will work, it's handy and natural.
>
>> By the way, regular expressions should work everywhere where we can
>> search for a string. For instance (from std.string):
>> auto firstMatchIndex = find("conoco", "co");
>> should work with a regex too:
>> auto firstMatchIndex = find("abracazoo", regex("a[b-e]", "g"));
> I agree, I have said the same thing regarding splitter()/xsplitter().
>
> Bye,
> bearophile
If the overhead of regex(string) is small enough (vs having it in the find/split
function) I'd go with overloads rather than different names.
More information about the Digitalmars-d
mailing list