Elixir method pattern matching with string contains

Viewed 4989

Is there any way to have String contains/regex in argument matching? For example, the string is "Some error happened". But I want it to match the substring "error happened". I tried this but it does not work:

  defp status({:error, ~r/error happened/}, state) do

  end
2 Answers
Related