• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

URGENT: Strip a header down

HI All;

I have the following string:

"MyODBC List" <myodbc@lists.mysql.com>

I want to lose everything but what is inside the <>, so I need a function/regexp that takes the string above and returns:

myodbc@lists.mysql.com

Lots of points because I want to deal with this quickly.
0
Squeebee
Asked:
Squeebee
  • 4
  • 3
1 Solution
 
shivsaCommented:
$text = 'MyODBC List" <myodbc@lists.mysql.com>';
preg_match_all("|<(.*)>|U",$text,$res);

print_r($res[0]);
0
 
shivsaCommented:
there is a syntex error in this.

$text = 'MyODBC List <myodbc@lists.mysql.com>';

preg_match_all("|<(.*)>|U",$text,$res);

print_r($res[0]);

0
 
SqueebeeAuthor Commented:
Man, thank for fast response. Any way to avoid the hassle of dealing with a return in an array?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SqueebeeAuthor Commented:
Oh, and the output is still wrapped in < >, I need it without any < >
0
 
SqueebeeAuthor Commented:
Nevermind, I managed to tweak it with a str_replace!

Thanks for your help!
0
 
shivsaCommented:
could u check what
print_r($res[1]); will return i think this should return without <>.


0
 
SqueebeeAuthor Commented:
Excellent, it does indeed.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now