Hi Steve,

Bit late to the party, but I would go something like:

$string = '[email protected]#mailto:[email protected]#';

if(preg_match('/#mailto:(?<email>[a-z...@\.]+)#/i', $string, $matches))
{
 $email = $matches['email'];
}

Benefit is that it is pretty easy to add additional matches, like: ''/(<link>[^#]+)#mailto:(?<email>[a-z...@\.]+)#/i' would give you $matches['link'] containing the link.

Cheers,
Stig

*yeosteve wrote*:
Hi

I have a field in a database with
[email protected]#mailto:[email protected]#  .  I want to reduce it
to just the email address.

Is is better/faster to use

substr($innerRow['PeopEmail'],0,strpos($innerRow['PeopEmail'],'#'))

or

array_shift(explode('#',$innerRow['PeopEmail']))


Thanks

Steve



--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to