Bug 16446 – Captures does not expose named captures for iteration

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-29T23:41:36Z
Last change time
2024-12-01T16:27:45Z
Assigned to
No Owner
Creator
Justin Whear
Moved to GitHub: phobos#10197 →

Comments

Comment #0 by justin — 2016-08-29T23:41:36Z
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);
Comment #1 by robert.schadek — 2024-12-01T16:27:45Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10197 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB