baffling str_replace

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

baffling str_replace

Post 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
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

more info here
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

yeah read that
still dont understand it :(
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post 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
Post Reply