Solved

URGENT: Strip a header down

Posted on 2003-12-10
7
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

732 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