Re: [PHP3] Reg. Exps. question. *Please have mercy* From: Jouni Ahto (jah <email protected>)
Date: 12/30/98

On Thu, 31 Dec 1998, wj gilmore wrote:

> Please don't flame me. I'm only learning regular expressions.

No I want flame you. Regexes really *are* quite cryptic. I still
don't understand a lot of things about them after using them 8
years...

> I'm working on a project that analyzes email information. We want to use PHP
> to set up an important piece of this project. However, the regular
> expression explanation seem to be a little over my head.
>
> Assuming I have a list of email addresses, I want to reveal the extension,
> and update a counter according to what kind of extension it has.
>
> For example, if I have the address gilmore <email protected> , what is the regular
> expression that will give me the 'it'?
>
> Or, if I have the address wj <email protected> , what is the regular expression
> that will give me the 'com'?
>
> I know I should use the ereg function, but what is the reg.exp. part?

$extension = eregi_replace('^.*\.(.*)$', '\\1', $mailaddress);

Jouni Ahto

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev <email protected>