Friday, February 10, 2023

REGEXP_LIKE to validate email id.

DECLARE

email VARCHAR2(50) := 'user@example.com';

BEGIN IF NOT REGEXP_LIKE(email, '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$') THEN raise_application_error(-20000, 'Invalid email'); END IF; END;

No comments:

Post a Comment

🔄 PostgreSQL Database Cloning via Backup and Restore

 When working with PostgreSQL, there are many situations where you need to  clone a database : Creating a dev or staging environment from pr...