This would be a bug from what I can see. the `\` seems to be giving
`Regex.compile/1` a fit.
On a mac, Elixir 1.2.5:
iex(1)> {:ok, rc} = Regex.compile("(?<version>\d+.\d+.\d+.\d+)*$")
{:ok, ~r/(?<version>\x7F+.\x7F+.\x7F+.\x7F+)*$/}
iex(2)> {:ok, rc} = Regex.compile("(?<version>\d+.\w+.\w+.\w+)*$")
{:ok, ~r/(?<version>\x7F+.w+.w+.w+)*$/}
If Jose is ok with you submitting the bug, I can take a look at it :)
~ Johnny
On Mon, Jun 6, 2016 at 2:28 PM, Onorio Catenacci <[email protected]>
wrote:
> 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
> <https://groups.google.com/d/msgid/elixir-lang-core/d921ceaf-de00-4137-ac6e-dc11209d3db8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CALBtUW6aTpPG3rNsmNEzCdxvtwyyfQVhANYvdpvORF%2Bb7XCqCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.