Solved

URGENT: Strip a header down

Posted on 2003-12-10
7
220 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 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