thehigherentity Posted November 20, 2007 Share Posted November 20, 2007 Im trying to update my BBCode function so it will check links and emails have the current beginnings eg mailto:, http:// etc What I would like to know is how i can add a function into the following so the $1 is checked my my fix_url() function. $str = ' My wbsite '; // my link $str = preg_replace('/\[url\=(.*?)\](.*?)\[\/url\]/is', '<a href="$1">$2</a>', $str); I have tried changing the code to the following and many versions of it with no luck! $str = ' My wbsite '; // my link $str = preg_replace('/\[url\=(.*?)\](.*?)\[\/url\]/is', '<a href="'.fix_url('$1').'">$2</a>', $str); If It cant be done this way could someone please point me in the right direction to another way I could do the same type of thing. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/78016-solved-call-a-function-while-using-preg_replace-is-it-posible/ Share on other sites More sharing options...
btherl Posted November 20, 2007 Share Posted November 20, 2007 It's done by this function. There's some examples in the comments on that page. Link to comment https://forums.phpfreaks.com/topic/78016-solved-call-a-function-while-using-preg_replace-is-it-posible/#findComment-394859 Share on other sites More sharing options...
thehigherentity Posted November 20, 2007 Author Share Posted November 20, 2007 Thanks a lot, I will take a look at that see if i can work it out Link to comment https://forums.phpfreaks.com/topic/78016-solved-call-a-function-while-using-preg_replace-is-it-posible/#findComment-394865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.