Hi,

I tried using named submatch for ctRegex... it works but seemingly only for maximum 1 named submatch...

OK (\w changed to \S to avoid, out of memory)
`(?P<var>\S+)\s*=\s*(\d+);`
`(?\S+)\s*=\s*(?P<value>\d+);`

NOT OK
`(?P<var>\w+)\s*=\s*(?P<value>\d+);`

Is this a known bug? I used the regex example from the Library Reference, converting it to ctRegex...

Lookup named submatch.
import std.regex;
import std.range;

auto m = match("a = 42;", regex(`(?P<var>\w+)\s*=\s*(?P<value>\d+);`));
auto c = m.captures;
assert(c["var"] == "a");
assert(c["value"] == "42");
popFrontN(c, 2);
//named groups are unaffected by range primitives
assert(c["var"] =="a");
assert(c.front == "42");

Reply via email to