<A HREF = "(.*)">(.*)</A>
and replace it with
[url = "1"]2[/url]
and then change it back again, i have started on the way to converting from <a to [url] this is what i have so far:
Code: Select all
<?
set_time_limit(0);
require("db.php");
$result = mysql_query("select * from table") or die(mysql_error());
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
$str = preg_replace("<a href="(.*?)">(.*?)</a>", "\[URL\]1\[\/URL\]", $line["txt"]);
$str = preg_replace("<A HREF="(.*?)">(.*?)</A>", "\[URL\]1\[\/URL\]", $line["txt"]);
$str = preg_replace("<A href="(.*?)">(.*?)</a>", "\[URL\]1\[\/URL\]", $line["txt"]);
if($str != $line["Body"])
$count++;
$ID = $line["ID"];
$update = mysql_query("update posts set Body = '$str' where ID = $ID") or die(mysql_error());
}
print "Sucessfull: " .$count ."texts were affected";
?>any help will be appreciated, thanks