Backport #8076
closedLookbehind assertion fails with /m mode enabled
Description
Lookbehind assertions fail if they are longer than one character, and if dotall mode is set.
irb(main):001:0> "foo" =~ /(?<=f)./m
=> 1
irb(main):002:0> "foo" =~ /(?<=fo)./m
=> nil
The latter should have matched the "o". This only seems to happen with dotall mode turned on (dot matches newline); without it, everything is OK:
irb(main):003:0> "foo" =~ /(?<=f)./
=> 1
irb(main):004:0> "foo" =~ /(?<=fo)./
=> 2
Updated by naruse (Yui NARUSE) over 11 years ago
Updated by k_takata (Ken Takata) over 11 years ago
すみません。上記パッチでは不足していることが分かりました。
https://github.com/k-takata/Onigmo/commit/962464a4dd4a9342febfd3e139d51d4282395b28
の regcomp.c に対するパッチも適用が必要なはずです。
なお、このパッチの regexec.c に対する修正は、 #3568 の修正による最適化の無効化を再度有効にするためのものですが、1.9.3にはそのままでは適用できません。
Updated by usa (Usaku NAKAMURA) over 11 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r39983.
Yui, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
-
regcomp.c (optimize_node_left, set_optimize_info_from_tree): right
handling for look behind anchor. -
regexec.c (onig_search): ditto.
[Backport #8076]
this patch is derived from Onigmo base tree.