phobos icon indicating copy to clipboard operation
phobos copied to clipboard

regex and ctRegex give different results

Open ntysdd opened this issue 9 months ago • 1 comments

I find regex and ctRegex give different results.

import std.stdio;
import std.regex;

void main()
{
    auto reg = ctRegex!("^(1+)\\1+$");
    foreach (i; 2..100)
    {
        char[] s = new char[i];
        s[] = '1';
        if (!s.matchFirst(reg))
        {
            writeln(i);
        }
    }
}

And both seem buggy.

ntysdd avatar Mar 19 '25 12:03 ntysdd

First post there https://github.com/dlang/dmd/discussions/15029#discussion-4995797

ntysdd avatar Mar 19 '25 12:03 ntysdd