Actions
Bug #5126
closedUnicode character classes interpolated into regex throws exception
Description
The following script runs under 1.9.2-p290:
# encoding: UTF-8
letter = '\p{L}'
atext = "[#{letter}]"
/#{atext}/
Under 1.9.3-preview1 it raises an exception:
test.rb:6:in `<main>': invalid character property name {L}: /[\p{L}]/ (RegexpError)
The interpolation is necessary to reproduce this bug, unicode character classes work fine when entered directly into the regex.
JRuby has a similar bug: http://jira.codehaus.org/browse/JRUBY-5622
This technique is used in datamapper to build a regex for matching emails:
https://github.com/datamapper/dm-validations/blob/master/lib/dm-validations/formats/email.rb
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r32791.
Xavier, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- insns.def (concatstrings): don't use initial ASCII-8BIT string.
[ruby-core:38635] [Bug #5126]
Actions
Like0
Like0