Project

General

Profile

Actions

Bug #22494

open

Regexp search misses a match when an assertion precedes a leading .*

Bug #22494: Regexp search misses a match when an assertion precedes a leading .*

Added by mame (Yusuke Endoh) 4 days ago. Updated 4 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127297]

Description

When a regexp starts with an assertion (^, \b, (?=...), (?!...)) followed by .*, the search only tries the start position and misses later matches.

"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 (Hiroya Fujinami) found this and wrote the fix.

Actions

Also available in: PDF Atom