\[code\]<p>some text is hrere</p><pre> <p> some more text is here </p></pre><p> some other text is here </p>\[/code\]In the above sample string, I wanted to replace \[code\]<p> and </p>\[/code\] tags which are outside the \[code\]<pre>\[/code\] tag with \[code\]<br/>\[/code\] tag and \[code\]<p> and </p>\[/code\] tags which are inside \[code\]<pre>\[/code\] tag with \[code\]\n\[/code\]. What is the regular expression for this in java?