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