Posted by Janwillem Borleffs on 12/02/88 11:54
elliott.linux@gmail.com wrote:
> ok what i need to do is modify all the link tags in a string from <a
> href="blah.html"> to <a href="clicktrough.php?uri=blah.html> but the
> problem is some of the tags have class so <a class="llama"
> href="blah.html"> but i dont want to change all of the tags that
> contain "href" because that would mess with the css.
>
Would something as follows do what you want?
preg_replace('/(?<=href=")([^"]+)/', 'clicktrough.php?uri=$1', $source);
JW
Navigation:
[Reply to this message]
|