Created
August 28, 2016 15:30
-
-
Save mattsnyder/007222fac550d72a233195e92db11307 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@char_types [{~r/(?<number>\d)/, :digit}, {~r/(?<letter>\w)/, :letter}, {~r/(?<allowed>[\(\)\.\-])/, :allowed} ] | |
defp identify_char(char) do | |
{_, type} = Enum.find(@char_types, {nil, :unknown}, fn {reg, type} -> | |
String.match?(char, reg) | |
end) | |
{type, char} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment