I'm trying to create a regex that will capture BB Codes, BB Codes with extra parameters ([url=http://]url[/url]
) etc. and work properly with nested BB Codes.
I would then recursively parse the BB Codes starting with the inner most.
This is what I have so far, but it breaks when I try to match nested BB Code.
Pattern:
\[(.*)\b=?([^=].*)?\](.*)\[/\1\]
Visit http://www.gskinner.com/RegExr/ and try the pattern and text below
Try this:
[b]sdfsdf[/b]
[b=extra]sdfsdf[/b]
[b=extra]left[u]middle[/u]right[/b]