title: Regex for matching string in parentheses including when opening or closing parenthesis is missing
body: <p>I want to match strings in parentheses (including the parens themselves) and also match strings when a closing or opening parenthesis is missing.</p>
  
  <p>From looking around my ideal solution would involve conditional regex however I need to work within the limitations of javascript's regex engine.</p>
  
  <p>My current solution that almost works: <code>/\(?[^()]+\)|\([^()]+/g</code>. I could split this up (might be better for readability) but am curious to know if there is a way to achieve it without being overly verbose with multiple <code>|</code>'s.</p>
  
  <h2>Examples</h2>
  
  <p>Might help to understand what I'm trying to achieve through examples (<code>highlighted</code> sections are the parts I want to match):</p>
  
  <ol>
  <li><code>(paren without closing</code></li>
  <li><code>(paren in start)</code> of string</li>
  <li>paren <code>(in middle)</code> of string</li>
  <li>paren <code>(at end of string)</code></li>
  <li><code>paren without opening)</code></li>
  <li>string without any parens</li>
  <li><code>(string with only paren)</code></li>
  <li>string <code>(with multiple)</code> parens <code>(in a row)</code></li>
  </ol>
  
  <p>Here's a link to the tests I set up in <a href="http://regexr.com/54ktq" rel="nofollow noreferrer">regexr.com</a>.</p>