I just checked sources of the application. elixre itself does require elixir version ~> 1.4 in its mix.exs, so it is very likely that you do have an older version which has a bug in its unescape-map?
Yes, my first test data was wrong. I revised it, but still get a “fail” (see below). My intent is to recognize lines which begin with “*” followed by a space – hence the ^ and the $
test "regex with *" do
text1 = """
foo + bar = foobar
Google: parsec parser combinator
blah blah
“”"
text2 = "yada yada\n* Google: parsec parser combinator\nfoo, bar"
result = Regex.scan(~r/^\* (\S.*)$/m, text2)
assert result != []
[_| target] = result
assert target == "Google: parsec parser combinator"
end
The test result is
1) test regex with * (ExperimentalTest)
test/lib/mu/experimental_test.exs:6
Assertion with == failed
code: target == "Google: parsec parser combinator"
left: []
right: "Google: parsec parser combinator"
stacktrace:
test/lib/mu/experimental_test.exs:18: (test)
The Elixre test for ^\* (\S.*)$ with option m and text
Actually, scan was what I wanted – I’m just being stupid. I am using scan in the app, but there is some weird interaction between some of the regex functions I use.
I have a question. I have little markup language in my app that runs a pipeline of regex-and-replace functions. Very crude, but it works pending building a real parser. I would like to move the regexes into a library. At the moment I have this:
defmodule MU.Regex do
def unordered_list_item_regex do
~r/^\* (\S.*)$/m
end
end
Is this the best way to proceed? My library of “constants” would basically be a module of constant functions.