elixir icon indicating copy to clipboard operation
elixir copied to clipboard

`~r/\W/` isn't the reverse of `~r/\w/` for non-ASCII letters

Open pminten opened this issue 12 years ago • 3 comments

iex(1)> Regex.run(~r/\w+/, "Götterfunken")
["Götterfunken"]
iex(2)> Regex.run(~r/\W+/, "Götterfunken")
["ö"]

This is weird, "ö" is simultaneously a word and a non-word character.

According to the Erlang re module docs: "In UTF-8 mode, characters with values greater than 128 never match \d, \s, or \w, and always match \D, \S, and \W.". That seems to indicate the first match (~r/\w/) is incorrect.

pminten avatar Mar 28 '14 08:03 pminten

It seems to be a bug in Erlang. Could you please report it to the erlang-bugs mailing list?

josevalim avatar Mar 28 '14 08:03 josevalim

Done.

pminten avatar Mar 28 '14 13:03 pminten

I am following it there and closng it there, thanks!

josevalim avatar Mar 28 '14 22:03 josevalim