How can I create a constraint to use a regular expression in postgres?
You can also create a domain and use it as a type when defining table columns, e.g.
CREATE DOMAIN email AS TEXT CHECK (VALUE ~* '^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]+$');
CREATE TABLE emails (
email email
);
This way you will not need to redefine the regex every time an email containing columns is used in the database.