Actions
Bug #13140
closedunmatched parenthesis error on regexp with "x" option when all parens are matched
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
Description
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
Updated by jdmeta (jake meta) about 7 years ago
Realized the problem.
The error is caused because the x option also ignores text after # and two # appear in the regex.
If these are escaped then the error goes away.
Updated by nobu (Nobuyoshi Nakada) about 7 years ago
- Status changed from Open to Rejected
Actions
Like0
Like0Like0