Issue #5126 has been reported by Xavier Shay.

----------------------------------------
Bug #5126: Unicode character classes interpolated into regex throws exception
http://redmine.ruby-lang.org/issues/5126

Author: Xavier Shay
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-07-31 revision 32789) [x86_64-darwin10.7.0]


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


-- 
http://redmine.ruby-lang.org