title: How do I replace an asterisk in Javascript using replace()?
body: <p>Using JQuery, I'm extracting the value from what is essentially a query box for some data in a MySQL database. Knowing that most users will use an '*' (asterisk) as a wildcard value and that MySQL uses the '%' character, I want to convert any asterisks to '%'.</p>
  
  <p>Normally, this would just be as simple as using </p>
  
  <pre><code>queryString = inputText.replace('*', '%');
  </code></pre>
  
  <p>but I've had little success with that. Javascript's <code>replace()</code> function only replaces the first occurrence, so it's not replacing the last asterisk in something like <code>*Foo*</code></p>
  
  <p>The second option I tried was using a regular expression, which also didn't work:</p>
  
  <pre><code>queryString = inputText.replace(/\x2a/g, '%');
  </code></pre>
  
  <p>How can I replace the '*' (asterisks) with a  '%' (percent sign)? I'd imagine there's a really simple regular expression, or something I'm overlooking.</p>