It falls back to the erlang regex compiler `:re.compile/1` so that might actually be where the problem starts.
On Mon, Jun 6, 2016 at 2:42 PM, Onorio Catenacci <[email protected]> wrote: > Yeah I think you've hit on the problem Johnny. It does appear the \d is > the issue. > > iex(10)> {:ok, rc} = Regex.compile("\d") > {:ok, ~r/\x7F/} > iex(11)> {:ok, rc} = Regex.compile("\w") > {:ok, ~r/w/} > > As I say, I can certainly do this without having to compile the regex but > it sure looks like a bug (albeit a minor one as far as I can tell). > > -- > Onorio > > > On Mon, Jun 6, 2016 at 2:37 PM, Johnny Winn <[email protected]> wrote: > >> 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 a topic in the >> Google Groups "elixir-lang-core" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/elixir-lang-core/7KxqS9FW5vw/unsubscribe >> . >> To unsubscribe from this group and all its topics, 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 >> <https://groups.google.com/d/msgid/elixir-lang-core/CALBtUW6aTpPG3rNsmNEzCdxvtwyyfQVhANYvdpvORF%2Bb7XCqCw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Onorio Catenacci > > http://onor.io > http://www.google.com/+OnorioCatenacci > > -- > 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/CAP%3DvNq8KzoK_hBq8RxyOUEUSUCaWUcN6kifMGAvfRidQ2AZPdg%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAP%3DvNq8KzoK_hBq8RxyOUEUSUCaWUcN6kifMGAvfRidQ2AZPdg%40mail.gmail.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/CALBtUW5N1neh6M5upGAqu0amE8Y2v%3DK4q76%2BtvoqyFmbL%2Bp0TA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
