Issue #14367 has been updated by Hanmac (Hans Mackowiak).


the problem is this:

~~~ ruby
/\c\xFF/.source == "\\c\\xFF"
~~~


which is already escaped

you might want this:

~~~ ruby
/#{"\c\xFF"}/ == //
~~~

or use this:

~~~ ruby
Regexp.compile("\c\xFF")
~~~


PS: it is correct that i get this?

~~~ ruby
"\c\xFF" ==  "\x9F" #=> true
~~~



----------------------------------------
Bug #14367: Wrong interpretation of backslash C in regexp literals
https://bugs.ruby-lang.org/issues/14367#change-69609

* Author: shyouhei (Shyouhei Urabe)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-01-16 trunk 61875) [x86_64-darwin15]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Following ruby code returns nil.

```sh
% LC_ALL=C ruby -ve 'p(/\c\xFF/ =~ "\c\xFF")'
ruby 2.6.0dev (2018-01-16 trunk 61875) [x86_64-darwin15]
nil
```

Is this intentional?



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