Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nicd/ef00fa21f7132d8b7f3d to your computer and use it in GitHub Desktop.
Save Nicd/ef00fa21f7132d8b7f3d to your computer and use it in GitHub Desktop.
get_number = fn (text) ->
case Regex.run(~r/\w (\d+)/, text) do
[_, number]
-> number
_
-> nil
end
end
"10" = _number = get_number.("a 10")
nil = _number = get_number.("a NO")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment