defmodule ElixirSecImage do
def isbase64(path) do
Regex.match?(~r|([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)|, path)
end
end
But it gives me the following error:
“do” is missing terminator “end”. unexpected token: “)” at line 3
How can I use Regex.match? in the function?
defmodule ElixirSecImage do
def isbase64(path) do
Regex.match?(~r|([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)|, path)
end
end
```[/quote]
Inside the regular expression you're using the same character that you're using as a sigil delimiter, so the parsing of it terminates early and stuff gets wonky. If you switch to `<` and `>` it'll run. At least for me.