std.regex.match

bearophile bearophileHUGS at lycos.com
Mon Aug 9 08:08:22 PDT 2010


A question about std.regex.match() design. I am not sure, so I ask here first (if the ideas are sane I will write an enhancement request later).

This is the current syntax you have to use to iterated on the matches:
foreach (m; match(text, regex(r"\d")).captures) {}


The regex() there is useful because you can add attributes like "g" as second argument, but often I don't need attributes. So is it possible to make match() accept a syntax like this too, that is more handy (the second argument of match() can be just a string, and there is no .captures):

foreach (m; match(text, r"\d")) {}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list