postgresql - Postgres Function to Validate Email Address -
a check constraint call function validate email addresses not working fine me.
create or replace function f_isvalidemail(text) returns boolean 'select $1 ~ ''^[^@\s]+@[^@\s]+(\.[^@\s]+)+$'' result ' language sql; select f_isvalidemail('myemail@address.com');
the function returning false, should true. have tried couple of other regexs in vain. can point out what's wrong function?
before go putting lot of effort this, thing want make sure you're not kicking out valid email addresses. there's kinds of insane rules can or can't in email address, , if wrong, in wrong direction, user valid email address might rejected system.
the best way determine if email address valid use part of registration process email required. else lot of work little gain.
Comments
Post a Comment