...

View Full Version : Regular Exp help



ecnarongi
02-04-2003, 09:19 PM
How would I take everything from an email after the @ and write it to the end of line?

ammil@rockafella.com and change it to ammil@rockafella.comrockafella.com

all help is appreciated. Thanks.

mordred
02-04-2003, 09:28 PM
You don't need a RegExp to do that:



$str = 'ammil@rockafella.com';
$strArray = explode('@', $str);

echo $str . $strArray[1];


But if you really want to, you can do that with RegExp:



echo preg_replace('/@(.+)$/i', '@\\\\1\\\\1', $str);

ecnarongi
02-04-2003, 09:34 PM
Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum