Captures.opIndex

Lookup named submatch.

import std.regex;
import std.range;

auto c = matchFirst("a = 42;", regex(`(?P<var>\w+)\s*=\s*(?P<value>\d+);`));
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");
  1. inout(R) opIndex(size_t i)
  2. R opIndex(String i)
    struct Captures(R)
    R
    opIndex
    (
    String
    )
    (
    String i
    )
    if ()

Meta