Reply to Re: PHP and email addresses

Your name:

Reply:


Posted by Rik on 06/12/06 00:56

Nick Bell wrote:
> Rik wrote:
>> Nick Bell wrote:
>>> The expression:
>>>
>>> preg_match_all("/text.*?([A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6})/i",$f,
>>> $matches);
>>>
>>> Returns ONE email address on a line in $f beginning 'text' - how do
>>> I retrieve ALL the email addresses on a line in $f beginning 'text'
>>> in php?
>>>
>>> Many thanks
>>
>> Without looking further at e-mail validation, adjust:
>> "/text.*?([A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6})/i"
>> to:
>> "/^text(:?.*?([A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}))*/i"
>>
>> Note that your regex will think .@..xx a valid email-adress.
>>
>> Grtz,
> Thanks. The $f is the result of file_get_contents(...) and the
> 'beginning of line' function ^ doesn't seem to detect the beginnings
> of lines generated using this method.

First: ^isn't a function.
Second: then try without:
"/text(:?.*?([A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}))*/i"

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация