Hi, having a problem refactoring using pattern matching for these lines of code
defp check_input(input, game = %State{}) do
input = String.trim(input)
cond do
input =~ ~r/\A[a-z]\z/ ->
Map.put(game, :guess, input)
true ->
IO.puts "please enter a lower-case letter"
accept_move(game)
end
end
Basically what I want to do is refactor the conditional logic, but I can’t seem to find a way to pattern match sigils using the where clause. Can anybody show me how?






















