[Issue 15489] regex - `(..).*\1` doesn't match "axxxx"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 19 10:41:34 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=15489

oddp <oddp at posteo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |oddp at posteo.de
         Resolution|WORKSFORME                  |---

--- Comment #9 from oddp <oddp at posteo.de> ---
This backreference issue isn't fixed entirely:

void main () {
    import std.regex, std.stdio;
    auto r = r"(..).*\1";
    foreach (s; ["abab", "abcab", "xababx", "xabcabx"])
        writefln("%s %s %s %s", s, s.matchFirst(r), s.match(r), s.bmatch(r));

    // abab    ["abab",  "ab"] [["abab",  "ab"]] [["abab",  "ab"]]
    // abcab   ["abcab", "ab"] [["abcab", "ab"]] [["abcab", "ab"]]
    // xababx  ["abab",  "ab"] [["abab",  "ab"]] [["abab",  "ab"]]
    // xabcabx [] [] []
}

Here are a handful ids that std.regex fails to match:

vrnyrnbfcx
jrqrkgdrqm
meflbefata
svdyayyedy
cwdpoivoie

Another hundred on the playground: https://run.dlang.io/is/O8slu9

// 100 out of 100 failed.

--


More information about the Digitalmars-d-bugs mailing list