Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing text from inside a string.

Status
Not open for further replies.

Geee

Programmer
Apr 23, 2001
253
GB
Hi guys, I did a quick search but am really struggling to do this:

I have a string;

a$ = 'MR DAVID JONES <david.jones@emailaddress.com>'

What I want to do, is end up with the string being just the person's name and not the email address, effectively removing anything after the first '<' character. I just know theres an easy way to do this, but its one of those mental block moments!

Thanks in advance.

-Geeeeeeeeeeeeeeeeeeeeeeee-
-=
 
or preg_match:

<?php
$a = 'MR DAVID JONES <david.jones@emailaddress.com>';
preg_match('/(^.*[^<])/',$a,$b);
echo $b[0];
?>

possibly overkill, but gives the desired reult also.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top