Reputation: 2333
@raw_array[i]=~/[\W]/
Very simple regexp. When I try it with some non-latin letters (russian to be specific) condition is false.
What can I do with this?
Upvotes: 7
Views: 2742
Reputation: 29291
@raw_array[i] =~ /[\p{L}]/
Tested with Cyrillic characters.
Reference: http://www.regular-expressions.info/unicode.html#prop
Upvotes: 9
Reputation: 34031
From the Regexp documentation:
/\W/
- A non-word character ([^a-zA-Z0-9_]
)
It's specifically not Unicode-aware. Perhaps something like this will work better for you:
@raw_array[i]=~/[^[:word:]]/
Upvotes: 2