Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX Validating an email address using REGEX

koyliJul 14 2022

Any APEX REGEX gurus out there ?
We've been using an "Item matches Regular Expression" validation to check the format of a text field used to enter an email address.
The regex we are using is:
^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
This worked OK till a user came along with a hyphenated surname - for example, firstname.beforehyphen-afterhyphen@domain.com will fail the validation.
If I test that regex in something like regexlib.com it passes with a hyphen. Does Oracle's regex work differently?
Demo of the field using the regex validation is here : https://apex.oracle.com/pls/apex/r/wscls/regexemail

Regards
Colin

This post has been answered by fac586 on Jul 14 2022
Jump to Answer
Comments
Post Details
Added on Jul 14 2022
6 comments
1,111 views