http://d.puremagic.com/issues/show_bug.cgi?id=5857
Summary: std.regex (...){n,m} is bogus when (...) contains
repetitions
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: critical
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Dmitry Olshansky <[email protected]> 2011-04-18
13:42:29 PDT ---
Uncovered while fixing greediness issues in current implementation.
For instance:
import std.regex;
void main(){
auto c = match("axxxzayyyyyzd",regex("(a.*z){2}d")).captures;
assert(c[0] == "axxxzayyyyyzd"); //asserts, there is no match ?!
assert(c[1] == "ayyyyyz");
}
While it's certainly matches, try http://www.regextester.com/
(both PHP preg & JavaScript one).
The reason is that .* on the first iteration jumps out of ...{2} "scope",
skipping next iteration of '(a.*z)' before trying 'd'.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------