Regex: Match strings outside of code blocks [duplicate]

I need a regex that will match strings outside of code blocks.

[b]bold[/b]

[code][b]bold[/b][/code]

[b]bold[/b]

I’ve tried ^(?!code)[b](.*?)[/b](?<!code), and although it will match the first [b]bold[/b] and ignores the code block, it also then ignores the bold after the code block.

https://regex101.com/r/tzuDji/1

What do I need to change to get it to ignore the code block only?