Surprisingly the regex matcher does not match backslash correcly. For example
Regex.split(~r{\\}, "C:\foo\bar")
["C:\foo\bar"]
Regex.match?(~r/\\/, "C:\foo\bar")
false
I would expect a positive match, but maybe I'm escaping \
wrong. Let's test that out:
Regex.escape("\\")
"\\\\"
Regex.split(~r{\\\\}, "C:\foo\bar")
["C:\foo\bar"]
Regex.match?(~r/\\\\/, "C:\foo\bar")
false
Still no match. Fairly confused at this point. How do you escape \
in a regex to match a literal \
as you can see in my usecase I would like to split a windows path.