Jump to content
php.lv forumi

preg_replace hipersaitēm


elxnis

Recommended Posts

Kādam nav aizķēries kāds labi strādājošs preg_replace skripts, lai veidotu hipersaites...

$text = preg_replace("/\s(([a-zA-Z]+:\/\/)([a-z][a-z0-9_\..-]*[a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i", " <a href=\"$1\">$1</a> ", $text);
$text = preg_replace("/\s(www\.([a-z][a-z0-9_\..-]*[a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i", " <a href=\"http://$1\">$1</a> ", $text);

šis dažas saites neizveido... :)

Link to comment
Share on other sites

×
×
  • Create New...