Created
March 24, 2011 21:47
-
-
Save chanmix51/885966 to your computer and use it in GitHub Desktop.
Returns true or false whatever the string given is a valid email or not
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
CREATE OR REPLACE FUNCTION is_email(email VARCHAR) RETURNS BOOLEAN AS $$ | |
BEGIN | |
RETURN email ~* '^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$'; | |
END; | |
$$ LANGUAGE plpgsql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment