jquery syntax highlighter

jquery syntax highlighter

I am using a syntax highlighter for my bbeditor. It basically adds a span arounds words within the <pre><code> tags to color them. The problem is that i am using a preview box which updates when you type something in to the text area. This looks for the bb tag [code] and replaces it with <pre><code></code></pre>. Since it does this everytime it updates the spans that were generated by the syntax highlighter get removed. Is there any way to prevent this?

the regex part:
  1.   /(?:%lb%|s)*[code(?:=?)(?:.*?)](?:%lb%|s)*(.*?)(?:%lb%|s)*[/code](?:%lb%|s)*/gi
gets replaced with
  1. '<pre><code>$1</code></pre>'