digitalmars.D.bugs - [Issue 16446] New: Captures does not expose named captures for
- via Digitalmars-d-bugs (23/23) Aug 29 2016 https://issues.dlang.org/show_bug.cgi?id=16446
https://issues.dlang.org/show_bug.cgi?id=16446 Issue ID: 16446 Summary: Captures does not expose named captures for iteration Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: justin economicmodeling.com The Captures struct maintains an internal list of named subexpressions in _names but it is private and the public API offers no way to discover which named subexpressions exist, only indexing when the subexpression's name is already known. Ideal usage scenario would look like this: string sample = "ABCDEFG"; auto re = regex( getExpressionFromuser() ); auto captures = sample.matchFirst(re); foreach (string name, string hit; captures.namedSubExpressions) writeln(name, ": ", hit); --
Aug 29 2016