-
-
Save Nicd/ef00fa21f7132d8b7f3d 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
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