[#115884] Windows Ruby 3.2.2: Non-English character added to Windows Registry String Value — Jay Mav via ruby-core <ruby-core@...>
Hello,
3 messages
2023/12/24
[ruby-core:115967] [Ruby master Bug#20097] Regexp#match? with empty capture group repeat is inconsistent
From:
"tompng (tomoya ishida) via ruby-core" <ruby-core@...>
Date:
2023-12-28 19:43:23 UTC
List:
ruby-core #115967
Issue #20097 has been updated by tompng (tomoya ishida).
Not same. https://bugs.ruby-lang.org/issues/20083 is related to regexp optimization from ruby 3.2.
This issue is not because it's same result in older ruby version 3.0 and 3.1
----------------------------------------
Bug #20097: Regexp#match? with empty capture group repeat is inconsistent
https://bugs.ruby-lang.org/issues/20097#change-105926
* Author: tompng (tomoya ishida)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +MN [arm64-darwin22]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
It sometimes matches and sometimes does not, depend on repeat quantifier number.
~~~ruby
# empty capture group repeat
p /(a(){1,4}){2}/.match?('aa') #=> true
p /(a(){1,5}){2}/.match?('aa') #=> false
# repeat of capture group that match to empty string
p /(a(|){1,2}){2}/.match?('aa') #=> true
p /(a(|){1,3}){2}/.match?('aa') #=> false
p /(a(x?y?|z){1,2}){2}/.match?('aa') #=> false
~~~
non-capturing group seems ok.
~~~ruby
p /(a(?:){1,4}){2}/.match?('aa') #=> true
p /(a(?:){1,5}){2}/.match?('aa') #=> true
p /(a(?:|){1,2}){2}/.match?('aa') #=> true
p /(a(?:|){1,3}){2}/.match?('aa') #=> true
p /(a(?:x?y?|z){1,2}){2}/.match?('aa') #=> true
~~~
Same behavior in ruby 3.0, 3.1, 3.2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/