Page 1 of 1

baffling str_replace

Posted: Wed Mar 24, 2004 1:02 pm
by malcolmboston
ok im currently in the midst of developing a BB-style code for my sites, however am stuck on the more complex expressions such as:
[url="www.example.com]example[/url]
to
<a href="\www.example.com>example</a>
and
[image src =www.example.com]
to
<img src=\"www.example.com\">

now im used to doing stuff like

Code: Select all

$formatted = preg_replace('/\[b\](.+?)\[\/b\]/is', '<b>\1</b>', $text);
however im unable to do the above mentioned 2 due to teh actual 'customisability' of the tags

would anyone care to enlighten me on this subject?

Thanks in advance

Posted: Wed Mar 24, 2004 2:34 pm
by redmonkey
more info here

Posted: Wed Mar 24, 2004 2:56 pm
by malcolmboston
yeah read that
still dont understand it :(

Posted: Wed Mar 24, 2004 4:01 pm
by PrObLeM

Code: Select all

$formatted = preg_replace('/\[url(.+?)\](.+?)\[\/b\]/is', '<a href="\1">\2</a>', $text);
i think that right ...i coulld be totally wrong