title: Markdown to convert double asterisks to bold text in javascript
body: <p>i'm trying to make my own markdown-able textarea like Stackoverflow has done. The goal is to allow people to type <code>**blah blah**</code> in a textarea and have the output in a div be <code>&lt;span style="font-weight:bold;"&gt;blah blah&lt;/span&gt;</code>.</p>
  
  <p>I'm having trouble with the javascript to find and replace to the **asterisks with the HTML.</p>
  
  <p>here's a jsfiddle which has gotten the party started: <a href="http://jsfiddle.net/trpeters1/2LAL4/14/" rel="noreferrer">http://jsfiddle.net/trpeters1/2LAL4/14/</a></p>
  
  <p>here's the JS on that just to show you where I'm at:</p>
  
  <pre><code>$(document.body).on('click', 'button', function() {
  
  var val=$('textarea').val();
  
  var bolded=val.replace(/\**[A-z][0-9]**/gi, '&lt;span style="font-weight:bold;"&gt;"'+val+'" &lt;/span&gt;');
  
  $('div').html(bolded);
  });
  </code></pre>
  
  <p>and the HTML...</p>
  
  <pre><code>&lt;textarea&gt;&lt;/textarea&gt;
  &lt;div&gt;&lt;/div&gt;&lt;button type="button"&gt;Markdownify&lt;/button&gt;
  </code></pre>
  
  <p>any thoughts would be greatly appreciated!</p>
  
  <p>thanks,
  tim</p>