A friendly reminder: I believe it's against forum rules to offer payment.
This function might serve your needs:
function validate_mp3_uri($str)
{
$regex = '^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]'
. '+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$';
if (!ereg($regex, $str) || (strtolower(substr($str, -4)) != '.mp3')) {
return false;
} else {
return true;
}
}
$str_arr = array('http://www.example.com/somefile.mp3',
"[url='http://www.example.com/somefile.mp3']",
'ftp://www.example.com/test.mp3',
'http://example.com.mp3?test=test');
foreach ($str_arr as $each_str) {
$result = validate_mp3_uri($each_str);
if ($result) {
echo $each_str . ' - Good<br />';
} else {
echo $each_str . ' - Bad<br />';
}
}
The regular expression was found at the site I linked to earlier.