The two characters in question are (I have marked some interesting things in bold):
The Ruby documentation for the Regexp
class does not explicitly spell out what [[:alpha:]]
matches, but it does say that the POSIX bracket expressions match non-ASCII characters, and it gives [[:digit:]]
as an example, saying it matches anything with the Unicode property Nd (Decimal Number).
While not explicitly documented, it makes sense to equate the Regexp
POSIX bracket expression [[:alpha:]]
with the Unicode property Alphabetic, which would mean that U+0BC0 matches and U+0BCD doesn't.
On the other hand, the documentation for Onigmo (the Regexp
engine used in YARV, and mirrored in all other implementations) does explicitly specify the workings of [[:alpha:]]
. In fact, it specifies it in two different places, and they contradict each other:
So, what seems to be going on, is that the Unicode Consortium does not consider U+0BCD to be alphabetic, and therefore, Onigmo and Ruby do not classify it as [[:alpha:]]
. In that case, the Onigmo documentation is incorrect, and the Ruby documentation is imprecise.
Regexp
/Onigmo./[[:alpha:]]/
?[:alpha:]
is equivalent to[a-zA-Z]
only. What happens if you use the Unicode equivalent[\p{L}\p{Nl}]
?Regexp
does not explicitly spell out what[[:alpha:]]
matches, but it does say that the POSIX bracket expressions match non-ASCII characters, and it gives[[:digit:]]
as an example, saying it matches anything with the Unicode property Nd. The Onigmo documentation explicitly specifies that[[:alpha:]]
matches Letter or Mark.[[:alpha:]]
might be using one of those properties, either exclusively, or in conjunction with Letter and Mark.