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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing text

Status
Not open for further replies.

AustinPowers

Technical User
Jul 26, 2002
35
US
How do I convert the following HTML back to URL's and email addresses?

Code:
<a target=&quot;_blank&quot; href=&quot;[URL unfurl="true"]http://whatever.com&quot;>http://whatever.com</a>[/URL]
<a target=&quot;_blank&quot; href=&quot;[URL unfurl="true"]http://www.whatever.com&quot;>http://www.whatever.com</a>[/URL]
<a href=&quot;mailto:whatever@whatever.com&quot;>whatever@whatever.com</a>

And... what code would I use to change [color=//]//[/color] and [align=//]//[/align] back to:

Code:
<font color=&quot;//&quot;>//</font>

<p align=&quot;//&quot;>//</p>

Thanks in advance. :)
 
I'll do the mailto for you, lets see if you can figure out the url for yourself :

<?php

$mailto='<a href=&quot;mailto:someone@somewhere.com&quot;>mail them</a>';
$chop_left=preg_replace(&quot;/<a href=\&quot;mailto:/&quot;,&quot;&quot;,$mailto);
$email=preg_replace(&quot;/\&quot;>.*$/i&quot;,&quot;&quot;,$chop_left);
echo &quot;email address : $email&quot;;
?> ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thanks!

But how would I change that so it'd look for multiple emails in a mysql mediumtext field?
 
Not sure, kind of looks like it'll work as it is - its late though so I may be wrong, ry it with more than 1 mailto in the string and see what happens. ______________________________________________________________________
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