Page 1 of 1

validating an email address

Posted: Tue Jun 06, 2006 3:47 am
by hame22
Hi

my current email validation will not allow valid emails in the format of name@domain.coop and name@domain.info even though they are valid emails.#


My code looks like this at the moment:

Code: Select all

eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email
any ideas what to change to allow these email addresses?

thanks in advance

Re: validating an email address

Posted: Tue Jun 06, 2006 3:53 am
by aerodromoi
hame22 wrote:Hi

my current email validation will not allow valid emails in the format of name@domain.coop and name@domain.info even though they are valid emails.#


My code looks like this at the moment:

Code: Select all

eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email
any ideas what to change to allow these email addresses?

thanks in advance
By setting the last part of the expression to (\.[a-z]{2,3}), you state that you only accept email addresses with a top level domain composed of two or three letters. Change that to (\.[a-z]{2,6}) and those with a .museum address will be happy as well.

aerodromoi

Posted: Tue Jun 06, 2006 4:50 am
by hame22
thanks for your responses, problem fixed!