What is the best way in PHP to clean an email address that a user submits in an input field?
$cleanRegEmail = preg_replace('/\s+/', "-", trim(preg_replace('/[^A-Za-z0-9]/', " ", $regEmail)));
the above code incorrectly cleans the email to: prefix-gmail-com (it removes the @ and the .)
thanks