title: regex to match absent groups at fixed locations
body: <p>A regex is needed that always matches (with <code>matches()</code>, not <code>find()</code>) and always recognizes 3 groups, for 3 different cases of input, like</p>
  
  <ol>
  <li>1234 ab$.5!c=:d6 efg(789)</li>
  <li>1234 efg(567)</li>
  <li>efg(567)</li>
  </ol>
  
  <p>The pattern</p>
  
  <pre><code>(?:^(\d+)\s+(\S)\s)?\s*([^\(]+\(\S+\))
  </code></pre>
  
  <p>represents the kind of values expected in each group (without assumptions about the location of characters), but only works correctly in case #1, producing</p>
  
  <pre><code>1234, ab$.5!c:d6, efg(789)
  </code></pre>
  
  <p>For cases 2 and 3, the same pattern does not work, giving, respectively</p>
  
  <pre><code>null, null, ab$.5!c:d6 efg(789)
  null, null, efg(789)
  </code></pre>
  
  <p>Any ideas?</p>