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

bearophile bearophileHUGS at lycos.com
Thu Feb 19 06:40:53 PST 2009


Simen Kjaeraas:
> auto re = regex("a[b-e]", "g");
> foreach (e; "abracazoo" / re) {
> }

D has operator overload, that Java lacks, but this fact doesn't force you to use them even when they are unreadable.

For people that like the "in" there I'd like to remind how it can look once (if it will ever happen) the foreach uses "in" too:

foreach (e in (re in "abracazoo")) {...}

Bye,
bearophile



More information about the Digitalmars-d mailing list