I am looking for a way to change this array for preg_replace.
// URLS
$pattern[1] = '/\[url\=(.*?)\](.*?)\[\/url\]/i';
$replace[1] = "<a href=\"http://$1\">$2</a>";
// IMAGES
$pattern[2] = '/\[img\=(.*?)\]/i';
$replace[2] = "<img src=\"http://$1\" alt=\"\" />";
So the if a user includes the http:// it will not add it, and if the user doesn’t add the http:// it will add it.
Currently it only works if a user disregards the http://
Thanks
Happy New Year!
Just add
(http://)?.BTW, why not use a character as a delimiter that is not in the pattern already? Like I used
~here.