Bug 11839 – std.regex capture group names should allow numbers to be in them
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-28T15:54:00Z
Last change time
2014-01-07T10:45:11Z
Keywords
pull
Assigned to
dmitry.olsh
Creator
tcdknutson
Comments
Comment #0 by tcdknutson — 2013-12-28T15:54:38Z
Given a regex like this:
---
import std.regex;
void main()
{
auto r = regex(`(?P<var1>\w+)`);
}
---
std.regex will throw this exception:
std.regex.RegexException@std\regex.d(1990): Expected '>' closing named group
Pattern with error: `(?P<var1` <--HERE-- `>\w+)`
Pattern with error: `(?P<var1` <--HERE-- `>\w+)`
Changing var1 to varone doesn't result in an error.
Perl allows capture group names to contain numbers, just not start with them, and I think it makes sense to follow this example.