Problem with RegEx for BBCode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am playing around with PHP and BBCodes and have found some regex's 
that should transform my BBCode into correct HTML when rendering. 
However, I have found that if the BBCode is not correct (eg missing 
closing tag), the regex completely eats my input and my page is empty!

The regex I'm using is:
/\[i\]((\s|.)+?)\[\/i\]/

And with an input like:
This is [i]italic.

I get nothing back.

What I would like is that when no closing tag is found, the opening tag 
should just be shown as-is. Anybody have any idea how I can do this?

Thanks!

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock              T +43 1 2198790-27
Floridsdorfer Hauptstr. 1           F +43 1 2198790-927
A-1210 Wien                         M +43 664 88657566
                                    E roland.asmann@xxxxxxxxx
                                    W www.adesso.at

-------------------------------------------------------------
             >>> business. people. technology. <<<
-------------------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux