/* ------------------------------------------------------------------------- */ /* Using REGEX in Oracle */ /* ------------------------------------------------------------------------- */ select * from course where regexp_like(description,'Java(script)?' ); --java or javascript select * from student where regexp_like(ssn, '^\d\d\d-\d\d-\d\d\d2$'); --an SSN with proper dashes --that has 2 in last digit select se.*, 'Email is valid' as "test regex" from student_email se where regexp_like(email, '^\w+(\.\w+)*@[0-9A-z]+\.[A-z]{2,4}$', 'i'); /*TEST ANY STRING AGAINST ANY REGEX PATTERN*/ select case when regexp_like('sam.sultan@hbo.com', '^\w+(\.\w+)*@[0-9A-z]+\.[A-z]{2,4}$' ) then 'valid' else 'invalid' end as "result" from dual;