[ruby-core:70148] [Ruby trunk - Bug #11399] [Open] Regexp's free-spacing mode adding whitespace to character classes

From: mail@...
Date: 2015-07-28 09:22:45 UTC
List: ruby-core #70148
Issue #11399 has been reported by Stefan Schテシテ殕er.

----------------------------------------
Bug #11399: Regexp's free-spacing mode adding whitespace to character classes
https://bugs.ruby-lang.org/issues/11399

* Author: Stefan Schテシテ殕er
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
The *free-spacing* mode (x-option) does not ignore whitespace within character classes:

~~~
r = /[a
  # comment
b]/x

" \nab".scan(r)
#=> [" ", "\n", "a", "b"]
~~~

I would expect a regular expression that's equivalent to `/[ab]/`



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

In This Thread

Prev Next