Created
March 23, 2015 17:16
-
-
Save eksperimental/fea870f40646d71e3440 to your computer and use it in GitHub Desktop.
is_regex
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
defmacro is_regex(term) do | |
quote do | |
is_tuple(unquote(Macro.escape term)) and ( | |
(elem(unquote(Macro.escape term), 0) in [:sigil_r, :sigil_R, :r, :R]) or | |
(elem( elem(unquote(Macro.escape term), 2), 0 ) == {:__struct__, Regex}) | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment