I need to match all of these opening tags:\[code\]<p><a href="http://stackoverflow.com/questions/1732348/foo">\[/code\]But not these:\[code\]<br /><hr class="foo" />\[/code\]I came up with this and wanted to make sure I've got it right. I am only capturing the \[code\]a-z\[/code\].\[code\]<([a-z]+) *[^/]*?>\[/code\]I believe it says:
- Find a less-than, then
- Find (and capture) a-z one or more times, then
- Find zero or more spaces, then
- Find any character zero or more times, greedy, except \[code\]/\[/code\], then
- Find a greater-than