Page 1 of 1

Parsing BBcode?

Posted: Mon Jan 19, 2009 2:54 pm
by zenhop
hello.

Here is a simple question:
How can I detect this code and replace it with the return of a php function?

code to detect and parse:
<fb:message title="hello">world</fn:function>

PHP function:
function parse_message($title, $content) {
return "<b>$title</b><br />$content";
}

Thank you in advance!

Re: Parsing BBcode?

Posted: Mon Jan 19, 2009 6:12 pm
by Burrito

Code: Select all

 
$output = preg_match('/<fb:message title="(.*?)">(.*?)<\/fn:function>/', $input, $matches);