Solved

URGENT: Strip a header down

Posted on 2003-12-10
7
219 Views
Last Modified: 2006-11-17
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
Comment
Question by:Squeebee
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9918147
$text = 'MyODBC List" <myodbc@lists.mysql.com>';
preg_match_all("|<(.*)>|U",$text,$res);

print_r($res[0]);
0
 
LVL 24

Accepted Solution

by:
shivsa earned 500 total points
ID: 9918171
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
 
LVL 17

Author Comment

by:Squeebee
ID: 9918197
Man, thank for fast response. Any way to avoid the hassle of dealing with a return in an array?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Author Comment

by:Squeebee
ID: 9918204
Oh, and the output is still wrapped in < >, I need it without any < >
0
 
LVL 17

Author Comment

by:Squeebee
ID: 9918238
Nevermind, I managed to tweak it with a str_replace!

Thanks for your help!
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9918239
could u check what
print_r($res[1]); will return i think this should return without <>.


0
 
LVL 17

Author Comment

by:Squeebee
ID: 9918246
Excellent, it does indeed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now