正则expression式 – 无效的属性名称

=~/\p{L}/ 

当我testingRubular时 – 它与select的1.9.2版本一起工作

但是irb:

 >> RUBY_VERSION => "1.9.3" ?> "test test".match(/\p{L}/) SyntaxError: (irb):3: invalid character property name {L}: /\p{L}/ from C:/Ruby193/bin/irb:12:in `<top (required)>' from -e:1:in `load' from -e:1:in `<main>' 

为什么?

它实际上工作:

 1.9.3p385 :001 > "test test".match(/\p{L}/) => #<MatchData "t"> 1.9.3p385 :002 > RUBY_VERSION => "1.9.3" 

你的问题应该是Windows的默认编码? 案例sensitivines? crazyness?

 "test test".match(/\p{L}/u) => #<MatchData "t"> "test test".match(/\p{L}/n) # same error you got SyntaxError: (irb):2: invalid character property name {L}: /\p{L}/ from /home/fotanus/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in `<main>'