Hi,

I changed it to this:
  preg_match_all('/(\w+\.)*\w+@(\w+\.)*\w+(\w+\-\w+)*\.\w+/', $str,  
$output);


It works great.

Sincerely,
Mike
-- 
Mike Brandonisio          *    Web Hosting
Tech One Illustration     *    Internet Marketing
tel (630) 759-9283        *    e-Commerce
[EMAIL PROTECTED]    *    http://www.jikometrix.net

     JIKOmetrix - Reliable web hosting


On Mar 22, 2007, at 4:45 PM, James Keeline wrote:

> --- Mike Brandonisio <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> I'm trying to flag and mask emails from a text string. I found this
>> on Zend but cannot get it to work. It is supposed to create an array
>> of email addresses but I think there is something wrong in the
>> 'preg_match_all' call for the pattern. I cannot figure out if this
>> pattern is even correct.
>>
>>    function get_emails ($str)
>>    {
>>      $emails = array();
>>      preg_match_all("/[EMAIL PROTECTED]/", $str, $output);
>>      foreach($output[0] as $email) array_push ($emails, strtolower
>> ($email));
>>      if (count ($emails) >= 1) return $emails;
>>      else return false;
>>    }
>>
>>    # Here is how to use it.
>>
>>    # Sample string containing email addresses;
>>    $str = "test [EMAIL PROTECTED] ha ha [EMAIL PROTECTED] bla bla  
>> [EMAIL PROTECTED]";
>>
>>    # Get the emails on arrays;
>>    $emails = get_emails ($str);
>>
>>    # Print that arrays;
>>    print_r ($emails);
>>
>> Sincerely,
>> Mike
>
> Try this:
>
> preg_match_all("/[EMAIL PROTECTED]/", $str, $output);
>
> James Keeline
>
>
> Community email addresses:
>   Post message: [email protected]
>   Subscribe:    [EMAIL PROTECTED]
>   Unsubscribe:  [EMAIL PROTECTED]
>   List owner:   [EMAIL PROTECTED]
>
> Shortcut URL to this page:
>   http://groups.yahoo.com/group/php-list
> Yahoo! Groups Links
>
>
>

Reply via email to