Reactormonk Reactormonk - 1 year ago 48
Ruby Question

How to match unicode words with ruby 1.9?

I'm using ruby 1.9 and trying to find out which regex I need to make this true:

Encoding.default_internal = Encoding.default_external = 'utf-8'
"föö".match(/(\w+)/u)[1] == "föö"
# => false

Answer Source
# encoding=utf-8 
p "föö".match(/\p{Word}+/)[0] == "föö"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download