[Issue 8529] ctRegex - named submatch - hash-table exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 25 07:22:38 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=8529


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #1 from monarchdodra at gmail.com 2013-02-25 07:22:34 PST ---
(In reply to comment #0)
> Reported on v2.060 (but no version seems to work).
> 
> The code is based on the opIndex example from:
> http://dlang.org/phobos/std_regex.html#regex
> 
> The normal regex version is functional, but when converting to ctRegex, the
> hashtable lookup throws.(
> 
> auto m = match("a = 42;", 
> ctRegex!(`(?P<var>\S+)\s*=\s*(?P<value>\d+);`));
> auto c = m.captures;
> 
> // c["var"]; =>
> core.exception.RangeError at std.regex(2145): Range violation
> 
> // c["value"]; =>
> Object.Exception at C:\D\dmd2\windows\bin\..\..\src\phobos\std\regex.d(2145): 
> no submatch named value

Just spent an hour duplicating this one.

Bump.

Since ctRegex is an "Experimental feature.", it may be worth documenting the
existence of this bug in http://dlang.org/phobos/std_regex.html#.StaticRegex.

If we don't know how to fix this, it may also be worth temporarily and
statically turning down named captures in static regexes, with a "sorry"
message.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list