Re: Regular expression
| From: | Analysis & Solutions | Date: | Wed, 17 Jul 2002 16:10:30 +0000 |
| Subject: | Re: Regular expression | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108107@lists.php.net to get a copy of this message | ||
On Wed, Jul 17, 2002 at 04:03:02PM +0200, Michal Albrecht wrote:
> Andrey Hristov wrote:
>
> >$your_string = preg_replace('/[\d\w]+@([\w\d]{3,}\.)+([\w]{2,4})/','',
>
> Thank you very much for your time, but this strips the e-mail address
> and lives the domain. Could you give me some hints on how to make it
> working the opposite way?
Let alone, it assumes TLD's are 2-4 characters long, when in reality,
they're presently up to 6 characters long.
preg_replace('/^([a-z0-9_.=+-])+@([a-z0-9-]+\.)+([a-z]{2,6})$/',
'\\1', $your_string);
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409