title: Javascript Regex Look behind
body: <p>In my web app I need to remove all whitespace and line breaks before and after the content between a pair of <code>``</code>. Example:</p>
  
  <p><code>``\s\s\s\s\stest1234\s\s\s\s23432\s\s\s\s\s\s\s``</code> would become something like this: <code>``test1234\s\s\s\s23432``</code>.</p>
  
  <p>(<code>\s</code> is a whitespace)</p>
  
  <p>The regex I wrote for this is: <code>/(``(?&lt;=[\s]*)[^`]*(?=[\s]*)``)/g</code> but I found out JS doesn't have look behind, how would I transform this regex into something that does the job?</p>
  
  <p>My JavaScript would look something like this: </p>
  
  <pre><code>replace(/(``(?&lt;=[\s]*)[^`]*(?=[\s]*)``)/g, function(match, p1) {
      return p1;
  })
  </code></pre>
  
  <p>Note, I only want to remove the outer whitespace, the ones that belong to the content need t be preserved. </p>