Last active
May 3, 2021 21:41
-
-
Save garethflowers/5448059 to your computer and use it in GitHub Desktop.
Validates if a value is an email string.
This file contains hidden or 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
| CREATE OR REPLACE FUNCTION is_email( | |
| anyelement | |
| ) | |
| RETURNS boolean | |
| LANGUAGE sql | |
| IMMUTABLE | |
| STRICT | |
| AS $$ | |
| SELECT $1::TEXT ~ '^\S+@\S+$'; | |
| $$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment