A little help needed with a replace function

A little help needed with a replace function

I am trying to replace a character with all headings but cannot seems to achieve it without also changing styles/href's. Here's my attempt at the function with a following example of the problem.
  1. $(document).ready(function() {
  2. ///////////////////////////////
  3. // find and replace headings //
  4. $('h1, h2, h3, h4, h5, h6').html(function (replaceos, osreplaced) {
  5. return osreplaced
  6. .replace(/o/g, '0')
  7. .replace(/O/g, '0');
  8. });
  9. });

<h3>Here is my string, I want t0 make changes here <span style="c0l0r: #4a1e51;">and here but n0t within the span tag</span></h3>
Anyone any ideas of how to do this?