title: Java; String replace (using regular expressions)?
body: <p>As part of a project for school, I need to replace a string from the form:</p>
  
  <pre><code>5 * x^3 - 6 * x^1 + 1
  </code></pre>
  
  <p>to something like:</p>
  
  <pre><code>5x&lt;sup&gt;3&lt;/sup&gt; - 6x&lt;sup&gt;1&lt;/sup&gt; + 1
  </code></pre>
  
  <p>I believe this can be done with regular expressions, but I don't know how to do it yet.</p>
  
  <p>Can you lend me a hand? </p>
  
  <p>P.S. The actual assignment is to implement a Polynomial Processing Java application, and I'm using this to pass polynomial.toString() from the model to the view, and I want do display it using html tags in a pretty way.</p>