I'm looking to create some regular expressions code for some testing. In the below I have created a Constraint Check for an email address.
create table testemail (username varchar2(50) NOT NULL,
Password varchar(15) Not NULL,
CONSTRAINT pk_usertest PRIMARY KEY (username),
CONSTRAINT un_emailtest CHECK (REGEXP_LIKE(username,'^([[:alnum:]]+)@[[:alnum:]]+.(com|net|org|edu|gov|mil)$'))
Is there a better way to have a constraint check when a new user creating an account?
Also, I'm trying to search a user by the name of 'Luke Haire' but my below sql queries returns no results:
select * from customers where regexp_like (name, '^([L(u|i|o)ke]+)[\][Haire]$');