Using Regular Expressions in Oracle

AttachmentSize
PDF icon Using_Regular_Expressions_in_Oracle.pdf157.94 KB
articles: 

Comments

Giving the output as No match found while using or . Please check this.

The author of the article (which is rather a good article, I think) has not visited the forum for some time, so I shall take the liberty of answering for him. The expression works for both your examples:

orclz> select case when REGEXP_LIKE('tom_kyte@oracle.com', '^([[:alnum:]]+(_?|\.))[[:alnum:]]*@[[:alnum:]]+(\.([[:alnum:]]+)){1,2}
$') then 'Match Found' else 'No Match Found' end as output from dual;

OUTPUT
--------------
Match Found

orclz> select case when REGEXP_LIKE('tom.kyte@oracle.com', '^([[:alnum:]]+(_?|\.))[[:alnum:]]*@[[:alnum:]]+(\.([[:alnum:]]+)){1,2}
$') then 'Match Found' else 'No Match Found' end as output from dual;

OUTPUT
--------------
Match Found

orclz>