I appreciate there are several email regexs on SO but couldn't find anything that would suits my case.
we have a email system that is failing with this regex:
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
$this->result = 0;
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if
(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|?([A-Za-z0-9]+))$",
$domain_array[$i])) {
$this->result = 0;
}
}
}
trying to email at an email address in the format:
my.name@some-text.value.subdomain.domain.co.uk
i assume it's the extra .value. that is causing the problem and i'm not very experienced with regex to fix this. can anyone help?
the regex..
^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|?([A-Za-z0-9]+))$
thanks in advance.