Regex Language group

This came from one of the exercism problems.

Can someone tell me why the \p{Cyrillic} doesn’t work … the \p{} thing is a new regex tool to me … so I may have a simple regex format failure

Note when I copy that text into google translate it says that it’s Russian

russian = “УХОДИ”
IO.puts “. = #{Regex.match?(~r/^.$/, russian)}"
IO.puts "L = #{Regex.match?(~r/^.
\p{L}.$/, russian)}"
IO.puts "Lu = #{Regex.match?(~r/^.
\p{Lu}.$/, russian)}"
IO.puts "Cyrillic = #{Regex.match?(~r/^.
\p{Cyrillic}.*$/, russian)}”

gives

$ iex t.exs
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] [hipe]

. = true
L = true
Lu = true
Cyrillic = false
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

@jonoke Please use special markdown for your code:

```
# your code goes here
```

I think you’re probably missing a /u at the end of your regex to enable Unicode support.

Ha! That fixed it.

Thanks.

1 Like