PHP Fomatting Regex - BBCode

Posted by Wayne on Stack Overflow See other posts from Stack Overflow or by Wayne
Published on 2010-05-24T21:20:41Z Indexed on 2010/05/24 21:41 UTC
Read the original article Hit count: 307

Filed under:
|
|
|
|

To be honest, I suck at regex so much, I would use RegexBuddy, but I'm working on my Mac and sometimes it doesn't help much (for me).

Well, for what I need to do is a function in php

function replaceTags($n)
{
    $n = str_replace("[[", "<b>", $n);
    $n = str_replace("]]", "</b>", $n);
}

Although this is a bad example in case someone didn't close the tag by using ]] or [[, anyway, could you help with regex of:

[[ ]] = Bold format

** ** = Italic format

(( )) = h2 heading

Those are all I need, thanks :)

P.S - Is there any software like RegexBuddy available for Mac (Snow Leopard)?

© Stack Overflow or respective owner

Related posts about php

Related posts about html