Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
hame22
Forum Contributor
Posts: 214 Joined: Wed May 11, 2005 5:50 am
Post
by hame22 » Tue Jun 06, 2006 3:47 am
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
aerodromoi
Forum Contributor
Posts: 230 Joined: Sun May 07, 2006 5:21 am
Post
by aerodromoi » Tue Jun 06, 2006 3:53 am
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
hame22
Forum Contributor
Posts: 214 Joined: Wed May 11, 2005 5:50 am
Post
by hame22 » Tue Jun 06, 2006 4:50 am
thanks for your responses, problem fixed!