Project

General

Profile

Bug #12477

Regexp with x modifier does not ignore space in character class

Added by Dan0042 (Daniel DeLorme) almost 4 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.2p120 (2016-05-21 revision 55092) [x86_64-linux]
[ruby-core:75914]

Description

The x modifier should cause all non-escaped spaces to be ignored in a regexp, right?
But consider that

 / [a] /x =~ " "  #=> nil
 / [ ] /x =~ " "  #=> 0

So spaces inside a character class are always literal, regardless of the x modifier. This has got to be a bug right?

Updated by Dan0042 (Daniel DeLorme) almost 4 years ago

My apologies. Looks like this is normal. http://www.regular-expressions.info/freespacing.html

Please close this issue.

Updated by naruse (Yui NARUSE) almost 4 years ago

  • Status changed from Open to Closed

Updated by usa (Usaku NAKAMURA) over 3 years ago

  • Status changed from Closed to Rejected

Also available in: Atom PDF