Regulární výrazy o.O
Max by mohl své BBcode-inspirované formátování rozšířit o pár prvků, ač vím, že ho tímto naštvu :P
'#[h([1-5])](.*?)[/h([1-5])]#is', // Header 1-5 ([h5]text[/h5]
'#[b](.*?)[/b]#is', // Bold (
text
'#[i](.*?)[/i]#is', // Italics (
text
'#[u](.*?)[/u]#is', // Underline (
text)
'#[s](.*?)[/s]#is', // Strikethrough ([s]text[/s])
'#[ul](.*?)[/ul]#is', // Unordered list (
)
'#[li](.*?)[/li]#is', // List line (
text)
'#[hr]#is', // Horizontal line (
)
'#[quote](.*?)[/quote]#is', // Quote ([quote]text[/quote])
'#[cite name="(.*?)"](.*?)[/cite]#is', // D20 format quote
'#[note](.*?)[/note]#is', // Note (graphical)
'#[question](.*?)[/question]#is', // Question (graphical)
'#[exclamation](.*?)[/exclamation]#is', // Exclamation (graphical)
'#[hide](.*?)[/hide]#is', // Hide (this text wont display in the output)
'#[code](.*?)[/code]#is', // Monospaced code [code]text[/code])
'#[size=([1-9]|1[0-9]|20)](.*?)[/size]#is', // Font size 1-20px [size=20]text[/size])
'#[color="#?(
-F0-9]{3}|-F0-9]{6})"](.*?)[/color]#is', // Font color, with # ([color="#00F"]text[/color])
'#[color="?(-F0-9]{3}|-F0-9]{6})"](.*?)[/color]#is', // Font color, no #, but still hexadecimal ([color="00F"]text[/color])
'#[color="(.*?)"](.*?)[/color]#is', // Font color, no #, text value ([color="red"]text[/color])
'#[url=((?:ftp|https?)://.*?)](.*?)[/url]#i', // Hyperlink with descriptive text ([url=http://url]text[/url])
'#[a href="((?:ftp|https?)://.*?)"](.*?)[/a]#i', // Hyperlink with descriptive text (text)
'#[url]((?:ftp|https?)://.*?)[/url]#i', // Hyperlink ([url]http://url[/url])
'#[img](https?://.*?.(?:jpg|jpeg|gif|png|bmp))[/img]#i', // Image (
http://url_to_image
)
'#[img src="(.*?)" title="(.*?)"]#i', // Image (
)
'#[page name="(.*?)"]#i', // D20 format page (
)
'#[/page]#i', // D20 format page closure ()
'#[br]#i' // break line (
); not needed since nl2br function (only old articles)