I have a function to insert some values into a table, but before inserting I want to check if e-mail address it's right. If not, break the function and returns an error. Case true, go on.
case when _email ~ '^[^@\s]+@[^@\s]+(\.[^@\s]+)+$' = true
then raise exception 'Incorrect email'
_email is the parameter of funcion. But it's not working. Should I use "IF" or other conditional?