title: Regex: match, but not if in a comment
body: <p>I have a file of data fields, which may contain comments, like below:</p>
  
  <pre><code>id, data, data, data
  101 a, b, c
  102 d, e, f
  103 g, h, i // has to do with 101 a, b, c
  104 j, k, l
  //105 m, n, o
  // 106 p, q, r
  </code></pre>
  
  <p>As you can see in the first comment above, there are direct references to a matching pattern. Now, I want to capture 103 and it's three data fields, but I don't want to capture what's in the comments.</p>
  
  <p>I've tried negative lookbehind to exclude 105 and 106, but I can't come up with a regex to capture both.</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>(?&lt;!//)(\b\d+\b),\s(data),\s(data),\s(data)
  </code></pre>
  
  <p>This will capture all but exclude capture of 105, but to specify</p>
  
  <pre class="lang-none prettyprint-override"><code>(?&lt;!//\s*) or (?&lt;!//.*)
  </code></pre>
  
  <p>as my attempt to exclude a comment with any whitespace or any characters invalidates my entire regex.</p>
  
  <p>I have a feeling I need a crafty use of an anchor, or I need to wrap what I want in a capture group and make a reference to it (like with <code>$1</code>) in my lookbehind.</p>
  
  <hr>
  
  <p>If this is another case of "regular expressions don't support recursion" because it's a regular language (a la automata theory), please point that out.</p>
  
  <p>Is it possible to exclude the comments in 103, and lines 105 and 106, using a regular expression? If so, how?</p>