Skip to content

Instantly share code, notes, and snippets.

@xaviershay
Created March 20, 2011 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xaviershay/5dd56997b3e5a8b9eee6 to your computer and use it in GitHub Desktop.
Save xaviershay/5dd56997b3e5a8b9eee6 to your computer and use it in GitHub Desktop.
# encoding: UTF-8
# String interpolation into regexes appears to break unicode property names.
# This script works under MRI 1.9.2
# Breaks under jruby --1.9
# The following two scenarios work
puts /[\p{L}]/u
puts /[#{"\\p{L}"}]/u
# this one raises an exception
# RegexpError: (RegexpError) invalid character property name {L}: /\p{L}/
b = "\\p{L}"
puts /[#{b}]/u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment