View Full Version : Regular Exp help

02-04-2003, 08: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.

02-04-2003, 08: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);

02-04-2003, 08:34 PM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum