Skip to content

std.regex: backreference to optional capture group throws Error when matching #10905

@pbackus

Description

@pbackus

As of DMD/Phobos v2.111.0, the following program throws an ArraySliceError when run:

import std.regex;

void main()
{
    auto re = regex(r"(a)?\1");
    auto _ = "xaa".matchFirst(re);
}

The error is:

core.exception.ArraySliceError@/usr/include/dmd/phobos/std/regex/internal/ir.d(846): slice [18446744073709551615 .. 0] has a larger lower index than upper index

The starting index, 18446744073709551615, is equal to cast(ulong) -1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Severity:RegressionIssues that are regressions/PRs that fix regressions

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions