Misspell
Mar 18th, 2008, 01:39 PM
What i would like to do is scan a chunk of text which will have urls in it.
Some of urls will have the HTML # (jump) in the href and some will not.
All urls will have target="blank", the urls with the # i would like to remove target="blank".
The HTML #value will be different all the time and the URL will also be different all the time.
<a target='blank' href="#Jump">bla</a> # remove - target
<a target='blank' href="http://url.com#Jump">bla</a> # remove - target
<a target='blank' href="http://url.com">bla</a> # keep- target
<a target='blank' href="http://ect.com">bla</a> # keep- target
Im horrible with preg_replace()
Could someone give me a helping hand and post an example of how to do this.
Thanks so much.
_
Some of urls will have the HTML # (jump) in the href and some will not.
All urls will have target="blank", the urls with the # i would like to remove target="blank".
The HTML #value will be different all the time and the URL will also be different all the time.
<a target='blank' href="#Jump">bla</a> # remove - target
<a target='blank' href="http://url.com#Jump">bla</a> # remove - target
<a target='blank' href="http://url.com">bla</a> # keep- target
<a target='blank' href="http://ect.com">bla</a> # keep- target
Im horrible with preg_replace()
Could someone give me a helping hand and post an example of how to do this.
Thanks so much.
_