www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.regex.match

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
Aug 09 2010