Welcome Guest, Not a member yet? Register   Sign In
add & to the preg_match check
#1

[eluser]theshiftexchange[/eluser]
Hi,

Can someone who is smarter than me explain how I include "&" in the following preg check?

Code:
public function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}

What I want is allow "&" in the first part of the email, only up to the "@" bit. I know its not best practice, but the company I develop for actually allows "&" in their email address, so its causing me some issues.

I tried to do this myself, but I cant get the preg_match to work properly. I know its really simple - but I'm obviously missing something...




Theme © iAndrew 2016 - Forum software by © MyBB