Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Regex that allow empty

Avatar of lenamtl
lenamtlFlag for Canada asked on
4 Comments1 Solution427 ViewsLast Modified:
Is this possible to allow empty field to this regex verification?
This is an email field javascript verification, this field is not mandatory
So if I don't fill this field I got 'Email address is not correct'

var ad = new RegExp("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
    if (!ad.test(f.email.value)) {
      jAlert("Email address is not correct.");
      return false;