@ivanhoe, mislio sam da postavi taj jedan spam post, da ne ubadamo...
http://ideone.com/aPqux
PHP kôd:
<?php
$input = "http://www.youtube.com/watch?v=itvJybdcYbI text [url=http://static.youtube.com/watch?v=itvJybdcYbI]What's up?[/url] text youtube.com/watch?v=itvJybdcYbI text www.youtube.com/watch?v=itvJybdcYbI";
echo can_haz_linkz($input)? 'Y': 'N';
$input = "text [url=http://static.youtube.com/watch?v=itvJybdcYbI]What's up?[/url] text";
echo can_haz_linkz($input)? 'Y': 'N';
function can_haz_linkz($input)
{
return preg_match(
"#([\w-]+:\/\/?|(www|([\w]+))[.])[^\s()<>\[\]]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/))#is",
(preg_replace("#\[url=(.*?)/url\]#is", '', $input))
);
}