title: Replace all character matches that are not escaped with backslash
body: <p>I am using regex to replace <code>(</code> in other regexes (or regexs?) with <code>(?:</code> to turn them into non-matching groups. My expression assumes that no <code>(?X</code> structures are used and looks like this:</p>
  
  <pre><code>(
    [^\\]     - Not backslash character
    |^        - Or string beginning
  )
  (?:
    [\(]      - a bracket
  )
  </code></pre>
  
  <p>Unfortunatelly this doesn't work in case that there are two matches next to each other, like in this case:  <code>how((\s+can|\s+do)(\s+i)?)?</code></p>
  
  <p><img src="https://i.stack.imgur.com/3sLlg.png" alt="image description"></p>
  
  <p>With lookbehinds, the solution is easy:</p>
  
  <pre><code>/(?&lt;=[^\\]|^)[\(]/g
  </code></pre>
  
  <p>But javascript doesn't support lookbehinds, so what can I do? My searches didn't bring any easy universal lookbehind alternative.</p>