Skip to Main Content

Visual Builder

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!

Email regexp pattern fails on validate emails

Kathryn HoggJul 1 2024

When we create an input form that contains an email field its is validated against the following regexp pattern:

([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})

Off the bat, we can see that the tld must be between 2 and 5 characters (aka .com, etc).

However, there are tlds that are longer than 5 chars such as .engineer (8), .energy (6) etc.

Also, it allows email addresses to start with a hyphen or period, neither of which is allowed.

Obviously I can change the regexp pattern on a case by case basis and hopefully remember to do that for new pages that email inputs. But that is tedious.

Is there any way to globably change the default pattern to something like

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

Comments
Post Details
Added on Jul 1 2024
7 comments
833 views