Input attributes and input text inside (valid) tags (except for [code]) will not contain[, ], =, or ".
Input: [b]bold[/b]
Output: <strong>bold</strong>
Input: [B]BOLD[/B]
Output: <strong>BOLD</strong>
Input: [b][i]bold italic[/i][/b]
Output: <strong><em>bold italic</em></strong>
Input: [url]http://example.com[/url]
Output: <a href="http://example.com">http://example.com</a>
Input: [url=http://example.com]click here[/url]
Output: <a href="http://example.com">click here</a>
Input: [img]http://example.com/image.png[/img]
Output: <img src="http://example.com/image.png">
Input: [color=red]red text[/color]
Output: <span style="color:red">red text</span>
Input: [size=20px]big text[/size]
Output: <span style="font-size:20px">big text</span>
Input: [quote]someone said this[/quote]
Output: <blockquote>someone said this</blockquote>
Input: [quote=John]someone said this[/quote]
Output: <blockquote><cite>John</cite>someone said this</blockquote>
Input: [b]unclosed tag
Output: [b]unclosed tag
Input: unopened tag[/b]
Output: unopened tag[/b]
Input: [unknown]text[/unknown]
Output: [unknown]text[/unknown]
Input: [b]nested [i]tags[/i] work[/b]
Output: <strong>nested <em>tags</em> work</strong>
Input: [url=http://test.com][b]bold link[/b][/url]
Output: <a href="http://test.com"><strong>bold link</strong></a>
Input: plain text with no tags
Output: plain text with no tags
Input: [code]<script>alert('hi')</script>[/code]
Output: <code><script>alert('hi')</script></code>
Input: [CoLoR=blue]case test[/color]
Output: <span style="color:blue">case test</span>
Input: [code][b]not bold[/b][/code]
Output: <code>[b]not bold[/b]</code>
Input: [code][url=http://test.com]link[/url][/code]
Output: <code>[url=http://test.com]link[/url]</code>
Input: [b][code]tags[/code] outside[/b]
Output: <strong><code>tags</code> outside</strong>
Input: [b][i][u]triple nested[/u][/i][/b]
Output: <strong><em><u>triple nested</u></em></strong>
Input: [color=red][b]colored bold[/b][/color]
Output: <span style="color:red"><strong>colored bold</strong></span>
Input: [quote=Alice][b]bold quote[/b][/quote]
Output: <blockquote><cite>Alice</cite><strong>bold quote</strong></blockquote>
Input: [url=http://test.com][color=blue]styled link[/color][/url]
Output: <a href="http://test.com"><span style="color:blue">styled link</span></a>
Input: [code][code]nested code[/code][/code]
Output: <code>[code]nested code[/code]</code>
Input: [u]foo[/u]
Output: <u>foo</u>
Input: plaintext
Output: plaintext
Input: [code]left[/code][code]right[/code]
Output: <code>left</code><code>right</code>