Hi,

That worked. Thank you. I'll play some more. I want to catch domains  
with hyphen and sub domain emails too like [EMAIL PROTECTED]

Thanks again.

Sincerely,
Mike
-- 
Mike Brandonisio                 *    IT Planning & Support
Tech One Illustration            *    Database Applications
tel (630) 759-9283               *    e-Commerce
[EMAIL PROTECTED]  *    www.techoneillustration.com


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