From: Ammar Ali Date: 2010-10-23T16:54:42+09:00 Subject: Re: Regexp Unicode property names strange behavior? --001636c5bd5f35f338049344129f Content-Type: text/plain; charset=UTF-8 On Sat, Oct 23, 2010 at 9:40 AM, Ammar Ali wrote: > On 1.9.2, I'm seeing an "invalid character property name" error from Regexp > for the named properties Any, Ascii, and Xdigit, but none of the others. If > I add the u option to the expression, it works. > > > # All good, with or without u option > [ 'Alnum', 'Alpha', 'Blank', 'Cntrl', 'Digit', 'Graph', 'Lower', > 'Print', 'Punct', 'Space', 'Upper', 'Word' > ].each {|name| puts /\p{#{name}}/ } > > > # Errors raised without u option > ['Any', 'Ascii', 'Xdigit'].each {|name| puts /\p{#{name}}/ } > > > # Now it's good > ['Any', 'Ascii', 'Xdigit'].each {|name| puts /\p{#{name}}/u } > > > I expected that all the names would either require the u option, or they > wouldn't. If it was just Any and Ascii, I would accept it and move on, but > Xdigit doesn't seem to belong with the other two. > > Trying to understand why Any, Ascii, and Xdigit are "special". Any clues > greatly appreciated. > > > Thanks, > Ammar > It was bad documentation! Xdigit should be XDigit, and Ascii should be ASCII. Any requires encoding to be specified, which makes sense. Sorry about the noise. Ammar --001636c5bd5f35f338049344129f--