My regex is matching but doesnt seem to be capturing. You may recognize this from the AOC challenges.

file contains...
**Valve AA has flow rate=0; tunnels lead to valves DD, II, BB**
**Valve BB has flow rate=13; tunnels lead to valves CC, AA**
**Valve CC has flow rate=2; tunnels lead to valves DD, BB**
**... etc**

```d
auto s = readText(filename);
auto ctr = ctRegex!(`Valve ([A-Z]{2}).*=(\d+).+valves(,* [A-Z]{2})+`);
foreach(c;matchAll(s, ctr)) {
        fo.writeln(c);
}
```

produces...
**["Valve AA has flow rate=0; tunnels lead to valves DD, II, BB", "AA", "0", ", BB"]** **["Valve BB has flow rate=13; tunnels lead to valves CC, AA", "BB", "13", ", AA"]** **["Valve CC has flow rate=2; tunnels lead to valves DD, BB", "CC", "2", ", BB"]**

what I'm attempting to achieve and expect is, for instance, on the 1st line... [....lead to valves DD, II, BB", "AA", "0", **", DD", ", II", ", BB"]**

Reply via email to