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

jovo jovo at at.home
Thu Feb 19 11:02:16 PST 2009


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:gnk8te$cgl$1 at digitalmars.com...
>
> Looks simple but it isn't. How do you advance to the next match?
>
> foreach (m; "abracadabra".match("(.)a", "g")) writeln(m.capture[0]);
>
> This should print:
>
> r
> c
> d
> r
>
> There's need to make progress in the matching, not in the capture. How do 
> you distinguish among them?
>
>
> Andrei

foreach(capture; match(s, r))
  foreach(group; capture)
    writeln(group);






More information about the Digitalmars-d mailing list