|
2026-10-10
| ||
| 18:47 | • New ticket [a6029ee505] regexp hangs with backreferences when a possible empty m... artifact: f60cd72d52 user: serhiy.storchaka | |
|
2013-07-26
| ||
| 13:25 | • Closed ticket [6585b21ca8]: Non-greedy match fails in combination with backrefer... artifact: 5835fa83ff user: dgp | |
| 13:24 | [6585b21ca8] [regexp {(\w).*?\1} abb] failed to match. Thanks to Tom Lane for passing on the discove... check-in: bff43cd4c3 user: dgp tags: trunk | |
| 13:21 | [6585b21ca8] [regexp {(\w).*?\1} abb] failed to match. Thanks to Tom Lane for passing on the discove... check-in: 2425a69341 user: dgp tags: core-8-5-branch | |
|
2013-07-18
| ||
| 23:03 | • New ticket [6585b21ca8] Non-greedy match fails in combination with backreference... artifact: 73755bb48f user: anonymous | |
Non-greedy match fails in combination with backreference
Closed / Fixed6585b21ca8fa6f3678d442b97241fdd43dba2ec0Created 13 years agoUpdated 13 years ago
Descriptionplain2013-07-18 23:03:22
This regexp test fails, though it should succeed:
% regexp {(\w).*?\1} {Programmer}
0
If you remove the '?', it does succeed, showing that the problem is restricted to non-greedy mode.
This problem was initially reported to the Postgres project:
http://www.postgresql.org/message-id/CAM2+6=U8CdfM-qL55XHt+7hVzDRBnZwrHiVZRX2shGZ4OMuMSQ@mail.gmail.com
As per the discussion there, it seems that this is a bug in cfindloop(), and that the fix is that the /* no point in trying again */ code block is wrong and should be replaced by a simple "break;", allowing the intermediate loop to continue iterating with the next possible "begin" value. I further suggested refactoring to merge that test into the subsequent statements that adjust estart/estop, but that's cosmetic, not essential to the fix.
Referenced by3
f60cd72d52New ticket [a6029ee505] regexp hangs with backreferences when a possible empty match fails. ticket2026-10-10 18:47:21bff43cd4c3[6585b21ca8] [regexp {(\w).*?\1} abb] failed to match. Thanks to Tom Lane for passing on the discovery in Postgres. check-in2013-07-26 13:24:192425a69341[6585b21ca8] [regexp {(\w).*?\1} abb] failed to match. Thanks to Tom Lane for passing on the discovery in Postgres. check-in2013-07-26 13:21:30
dgpplain2013-07-26 13:25:19
Fixed for 8.5.15 and 8.6.1.
Log in (anonymous is fine) to add a comment.