digitalmars.D.bugs - [Issue 15489] New: regex - match/matchAll and bmatch - different
- via Digitalmars-d-bugs (32/32) Dec 31 2015 https://issues.dlang.org/show_bug.cgi?id=15489
https://issues.dlang.org/show_bug.cgi?id=15489 Issue ID: 15489 Summary: regex - match/matchAll and bmatch - different output Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: gassa mail.ru I want to test for the pattern "two consecutive characters, arbitrary sequence, the same two consecutive characters". My pattern is r"(..).*\1". It works with bmatch but not with match/matchAll. A complete example follows. import std.regex, std.stdio; void main () { writeln (bmatch ("abab", r"(..).*\1")); // [["abab", "ab"]] writeln (match ("abab", r"(..).*\1")); // [["abab", "ab"]] writeln (matchAll ("abab", r"(..).*\1")); // [["abab", "ab"]] writeln (bmatch ("xabab", r"(..).*\1")); // [["abab", "ab"]] writeln (match ("xabab", r"(..).*\1")); // [] writeln (matchAll ("xabab", r"(..).*\1")); // [] } As you can see, bmatch (usage discouraged in the docs) gives me the result I want, but match (also discouraged) and matchAll (way to go) don't. Original thread in D.learn: http://forum.dlang.org/thread/lqjffwcpzayznqljxsuu forum.dlang.org. No one replied so far, so I assume this is a bug. --
Dec 31 2015