ctRegex - named submatch

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Aug 8 09:53:18 PDT 2012


On 08-Aug-12 02:05, Daniel wrote:
> On Tuesday, 7 August 2012 at 20:51:28 UTC, Dmitry Olshansky wrote:
>> That all being said experimental tag on ctRegex in DDoc is here for a
>> reason, and that is: ctRegex can't compile nor match full regex
>> testsuite.
>
> Understood, thanks for your quick response nevertheless. :)
>
> There are different errors depending on which of the two captures is
> attempted to be accessed.
>
> 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 su
> bmatch named value
>
Yikes! Something is wrong with hash-table that maps names to indexes 
(it's just it).

File this as bug please, including the example.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list