title: Using Regular Expression to convert Textile italic markup to HTML
body: <p>I inherited a Wordpress site with a few years worth of Textile markup in image captions. Rather than stripping them out I'd like to use some jQuery to turn italics that have been marked up like this:</p>
  
  <pre><code>Hello this is some _italic text_ here.
  </code></pre>
  
  <p>to this</p>
  
  <pre><code>Hello this is some &lt;em&gt;italic text&lt;/em&gt; here.
  </code></pre>
  
  <p>Thanks, here is what I tried, based on the answers below.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  jQuery().ready(function() {
  jQuery("p.wp-caption-text").each(function(n) {
      this.innerHTML = this.innerHTML.replace(new RegExp("_([^{]*)_"), "&lt;i&gt;$1&lt;/i&gt;");
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>It works, but in my markup sometimes it doesn't seem to find the second _ character.</p>
  
  <p>Here is a real-world example:</p>
  
  <pre><code>  &lt;p class="wp-caption-text"&gt;Left: Paul Klee, _Grosses Tier (Large Beast)_, 1928; fractional and promised gift of the Djerassi Art Trust. Right:  Andrew Schoultz, _Three Caged Beasts_, 2011; Courtesy the artist and Marx &amp;amp; Zavattero; © Andrew Schoultz&lt;/p&gt;
  </code></pre>
  
  <p>For this one, it produces this:</p>
  
  <pre><code>&lt;p class="wp-caption-text"&gt;Left: Paul Klee, &lt;i&gt;Grosses Tier (Large Beast)_, 1928; fractional and promised gift of the Djerassi Art Trust. Right:  Andrew Schoultz, _Three Caged Beasts&lt;/i&gt;, 2011; Courtesy the artist and Marx &amp;amp; Zavattero; © Andrew Schoultz&lt;/p&gt;
  </code></pre>
  
  <p>Any idea how the regexp could be modified to fix this?</p>