SELECT `justfunctions.eu.validate_email`("12/[email protected]")
/*--Output--
0
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.validate_email`(`email` STRING)
RETURNS INT AS (CASE
WHEN NET.REG_DOMAIN(lower(email)) IS NULL THEN 0
WHEN REGEXP_CONTAINS(lower(email), "^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])$") THEN 1
ELSE 0
END
)
OPTIONS ( description = '''Validates if an <email> address is properly formatted.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.