Forum Moderators: coopster

Message Too Old, No Replies

using preg_match to insert text at a certain point

         

scorpion

3:54 pm on Jul 4, 2003 (gmt 0)

10+ Year Member



If you have a string like <a href="53/43.html"> is it possible to use preg_match to insert a line of text between the quote and the first numeral (assuming there are many other href tags in the file?) The only thing you know is that the tags you want to replace have a number as the first character in the href tag. E.g.
<a href="goto.php?53/43.html">

vincevincevince

4:25 pm on Jul 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




$text=preg_replace("/\<a href=\"([1-9])/","<a href=\"goto.php?$1",$text)

given what you said as true, i think that'll work

let me know