title: match a string from a text with a Regexp
body: <p>I need to get a valid javascript string from text, I tried a lot, but escape characters are bothering me.</p>
  <p>Here's code:</p>
  <p>Regexp:</p>
  <pre class="lang-js prettyprint-override"><code>const Regexp = /([&quot;']).*?((?&lt;!\\)\1)/;
  </code></pre>
  <p>It does work sometimes</p>
  <ul>
  <li><p><strong>text</strong>: <code>'$$\''</code></p>
  <p><strong>expect</strong>: <code>'$$\''</code></p>
  </li>
  <li><p><strong>text</strong>: <code>'\\''</code></p>
  <p><strong>expect</strong>: <code>'\\'</code></p>
  <p><strong>unexpected</strong>: <code>'\\''</code></p>
  <p><strong>Note</strong>: Two <code>\</code> is a valid javascript string, so the <code>'</code> after <code>\\</code> is the correct closing quotes.</p>
  </li>
  </ul>