Issue #22494 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #22494: Regexp search misses a match when an assertion precedes a leading .* https://bugs.ruby-lang.org/issues/22494 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- When a regexp starts with an assertion (`^`, `\b`, `(?=...)`, `(?!...)`) followed by `.*`, the search only tries the start position and misses later matches. ```ruby "aab".index(/(?!a).*b/m) #=> nil (expected: 2) "ab\ncb".index(/^.*b/m, 1) #=> nil (expected: 3) "aaaa bx".index(/\b.*x/, 1) #=> nil (expected: 4) ``` @make_now_just found this and wrote the fix. -- https://bugs.ruby-lang.org/