[ruby-core:69782] [Ruby trunk - Bug #11311] STRING::Scan method badly interpret i option - Ruby 2.1.*

From: cremno@...
Date: 2015-06-29 23:21:34 UTC
List: ruby-core #69782
Issue #11311 has been updated by cremno phobia.


That's a known and [documented](http://docs.ruby-lang.org/en/2.2.0/Regexp.html#class-Regexp-label-Character+Classes) bug:

>`/\W/` - A non-word character (`[^a-zA-Z0-9_]`). Please take a look at Bug #4044 if using `/\W/` with the `/i` modifier.

It has been fixed by [Onigmo 5.15.0](https://github.com/k-takata/Onigmo/blob/Onigmo-5.15.0/HISTORY#L9-L11) / Ruby 2.2. Maybe it can or even should be backported?

----------------------------------------
Bug #11311: STRING::Scan method badly interpret i option - Ruby 2.1.* 
https://bugs.ruby-lang.org/issues/11311#change-53158

* Author: Agathe Begault
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.1.6
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
~~~ruby
'SKYPE'.scan(/[^aeiouyAEIOUY\W]/i) #returns ["P"] instead of ["S", "K", "P"]
~~~
Tested on Ruby 2.1.3 / 2.1.5 / 2.1.6
regexp i option: case insensitive

https://github.com/ruby/ruby/blame/trunk/string.c#L7681



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

In This Thread

Prev Next