Project

General

Profile

Bug #20083

Updated by jussikos (Jussi Koljonen) 5 months ago

From irb, when calling String#match? 


 ``` 
 pattern = /([\s]*ABC)$/i # or /\s*(ABC)/i 

 p "1ABC".match?(pattern) # => true 
 p "12ABC".match?(pattern) # => true 
 p "123ABC".match?(pattern) # => true 
 p "1231ABC".match?(pattern) # => true 
 p "12312ABC".match?(pattern) # => false 
 p "123123ABC".match?(pattern) # => false 
 p "1231231ABC".match?(pattern) # => true 
 p "12312312ABC".match?(pattern) # => true 
 p "123123123ABC".match?(pattern) # => false 
 p "1231231231ABC".match?(pattern) # => false 
 p "12312312312ABC".match?(pattern) # => true 
 p "123123123123ABC".match?(pattern) # => true 
 p "1231231231231ABC".match?(pattern) # => false 

 
 ``` 

 With `ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]` and earlier versions (2.7.8 to 3.2.2) return value is always `true`

Back