std.regex named matches

James Miller james at aatch.net
Wed Feb 8 01:07:26 PST 2012


Hi,

I am using std.regex and using the named matches. I would like to be
able to get at the names that have matched, since this is library
code.

e.g.

    auto m = match("test/2", regex(r"(?P<word>\w+)/(?P<num>\d)"));
    //either
    auto names = m.names;
    //or
    auto names = m.captures.names;

or something similar. I've looked at the library and I can't find
anything of the sort, and you can't even use `foreach` to get at them
that way, I'm guessing because you can have both integer and string
indexes for the matches.

Thanks

James Miller


More information about the Digitalmars-d-learn mailing list