Issue #18345 has been reported by halilsen (Halil Sen).

----------------------------------------
Bug #18345: Duplicate range in character class warning
https://bugs.ruby-lang.org/issues/18345

* Author: halilsen (Halil Sen)
* Status: Open
* Priority: Normal
* ruby -v: >= 2.5.5
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
~~~ ruby
#!/usr/bin/env ruby -w
puts RUBY_VERSION
puts "".match?(/[\p{Alnum}|\-|\_]/).inspect
puts '--------------'
~~~

~~~ text
trial.rb:3: warning: character class has duplicated range: /[\p{Alnum}|\-|\_]/
2.5.5
false
--------------
trial.rb:3: warning: character class has duplicated range: /[\-|\p{Alnum}|\_]/
2.7.4
false
--------------
~~~

If I remove any part of the character class definition `[]`, there is no warning but
I don't think there's a duplicate range here, so there should not be a warning.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>