Welcome Guest, Not a member yet? Register   Sign In
preg_replace / regex - add attributes to link question
#1

[eluser]BobbyB[/eluser]
Hi,
my urls(in a string) look like this:
Code:
<a href="http://bit.ly/ddGgAi" class="twitter_news_links" target="_blank">http://bit.ly/ddGgAi</a>
I am trying to change them all to:
Code:
<a href="http://bit.ly/ddGgAi" class="twitter_news_links tips" term="http://bit.ly/ddGgAi" target="_blank">http://bit.ly/ddGgAi</a>
So I need to add a class name and the "term" Attribute which is supposed to be the same as "href".
How would you do this?
I have been playing around with regex/preg_replace but couldn't come up with a solution.
Any help is appreciated.


Messages In This Thread
preg_replace / regex - add attributes to link question - by El Forum - 03-25-2010, 12:33 PM
preg_replace / regex - add attributes to link question - by El Forum - 03-25-2010, 12:57 PM
preg_replace / regex - add attributes to link question - by El Forum - 03-25-2010, 01:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB