Issue #13140 has been updated by Nobuyoshi Nakada.

Status changed from Open to Rejected

http://ruby-doc.org/core-2.4.0/doc/regexp_rdoc.html#label-Free-Spacing+Mode+and+Comments

----------------------------------------
Bug #13140: unmatched parenthesis error on regexp with "x" option when all parens are matched
https://bugs.ruby-lang.org/issues/13140#change-62609

* Author: jake meta
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
See the attached source file.

When the attached file is executed as is, the following error is emitted:
   test.rb:39: end pattern with unmatched parenthesis: /^(%([^%]+)%)?+((_?+)([^#]+))(#|$)/x

There are no unmatched parens in the regex.

The error also occurs in the following scenarios:
- Spaces are inserted into the regex.
- The %r{} literal is used. It's interesting that in this scenario, the error message displayed is identical to the
  one above, i.e. the forward slashes appear in the error message even though the source uses %r{}.
- The section array is moved above the row array (note the presence of the regex using an x option on line 30).

The error does not occur in any of the following scenarios:
- The x option is removed.
- The x option is replaced with the i option.
- The x option is replaced with the m option.


---Files--------------------------------
test.rb (1.01 KB)


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