[ruby-core:86149] [Ruby trunk Bug#14608] Regexp::union and forward slashes

From: jason.barnabe@...
Date: 2018-03-15 18:57:43 UTC
List: ruby-core #86149
Issue #14608 has been reported by jason.barnabe (Jason Barnabe).

----------------------------------------
Bug #14608: Regexp::union and forward slashes
https://bugs.ruby-lang.org/issues/14608

* Author: jason.barnabe (Jason Barnabe)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
When using Regexp::union and a regular expression with a forward slash, there seem to be some inconsistencies.

~~~ ruby
# this is weird
Regexp.union(/\//, '')                  # => /(?-mix:\/)|/
Regexp.union(/\//, '') == /(?-mix:\/)|/ # => false

# here is the difference
Regexp.union(/\//, '').source           # => "(?-mix:\\/)|"
/(?-mix:\/)|/.source                    # => "(?-mix:/)|"
~~~


Previously reported at https://github.com/janosch-x/js_regex/issues/6



-- 
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>

In This Thread

Prev Next