Page 1 of 1

Remove character before/after symbol

Posted: Mon Aug 23, 2010 8:15 pm
by spyworld
I would like to remove a symbol after another symbol.

Example:
email#@gmail.com change to email@gmail.com
email+^@hotmail.com change to email@hotmail.com

Remove all the symbol before "@"

Example:
*me^personal*email@yahoo.com change to email@yahoo.com

If the email address is all symbol before "@", delete from database.
*^$!@yahoo.com direct delete from database.

How to write the script? feel like very complicated.

Re: Remove character before/after symbol

Posted: Mon Aug 23, 2010 8:28 pm
by ScOrPi
use

preg_replace function

like this

Code: Select all

$mail = "example$";
$at_company = "@yahoo.com";
$mail_with_out_sym = preg_replace("symblos here",$mail);

Re: Remove character before/after symbol

Posted: Mon Aug 23, 2010 10:43 pm
by shawngoldw
This sounds like an odd thing to be trying to do. If I may ask, why are you trying to do this? Are you trying to validate the email address?

Shawn