Last active
August 29, 2015 14:17
-
-
Save eksperimental/88596033712d90520a97 to your computer and use it in GitHub Desktop.
Variable assign after regex run
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