Hi all,
Not sure if this is a bug or simply me misunderstanding the mechanism of
regex's. I hope no one minds me asking about this here so I don't file a
bug if it's just a misunderstanding on my part.
On Windows 10 with Elixir 1.2.6, I've been working on a regex to pull the
version portion of a string. This works:
iex(4)> v =
Regex.named_captures(~r/(?<version>\d+.\d+.\d+.\d+)*$/,"Version=15.0.4815.1002")
%{"version" => "15.0.4815.1002"}
iex(5)> v
%{"version" => "15.0.4815.1002"}
iex(6)> v["version"]
"15.0.4815.1002"
But as I was playing with the regex, I found this which struck me as sort
of curious:
iex(7)> {:ok, rc} = Regex.compile("(?<version>\d+.\d+.\d+.\d+)*$")
{:ok, ~r/(?<version>\x7F+.\x7F+.\x7F+.\x7F+)*$/}
iex(8)> rc
~r/(?<version>\x7F+.\x7F+.\x7F+.\x7F+)*$/
Which when I try with named_captures gives me this:
iex(9)> v = Regex.named_captures(rc,"Version=15.0.4815.1002")
%{"version" => ""}
Knowing this is Windows 10 and knowing the issues we've had with unicode
over the years, I ran chcp 65001. The problem still occurs. It's a minor
issue because as you can see, I've got a working regex.
So am I misunderstanding something or is this a bug? Any advice would be
appreciated.
--
Onorio
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/d921ceaf-de00-4137-ac6e-dc11209d3db8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.