title: Help with regex in a Processing sketch?
body: <p>I am a beginning programmer trying to parse an HTML file in a Processing sketch. (Incidentally, if you don't know Processing, it compiles to Java and uses the same regex functions). I have correctly captured the HTML file as a single String using SimpleML. The data I'm trying to capture comes from a table, like so:</p>
  
  <pre><code>&lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;John F. Kennedy&lt;/th&gt;
      &lt;th&gt;Lyndon Johnson&lt;/th&gt;
      &lt;th&gt;Richard Nixon&lt;/th&gt;
  </code></pre>
  
  <p>etc.</p>
  
  <p>I want to parse out the names of candidates into an array (dropping the "Name").</p>
  
  <p>So I first tried</p>
  
  <pre><code>    candidates = match(rawString,"&lt;th&gt;.*&lt;/th&gt;");
  </code></pre>
  
  <p>which returned the whole list.</p>
  
  <p>Then I tried</p>
  
  <pre><code>    candidates = match(rawString,"&lt;th&gt;.{1,50}&lt;/th&gt;");
  </code></pre>
  
  <p>which returns only </p>
  
  <pre><code>&lt;th&gt;Name&lt;/th&gt;
  </code></pre>
  
  <p>The Processing documentation says:</p>
  
  <blockquote>
    <p>If there are groups (specified by sets of parentheses) in the regexp, then the contents of each will be returned in the array. Element [0] of a regexp match returns the entire matching string, and the match groups start at element [1] (the first group is [1], the second [2], and so on). </p>
  </blockquote>
  
  <p>So now I've been trying various combinations of groups and quantifiers, like:</p>
  
  <pre><code>    candidates = match(rawString,"(&lt;th&gt;.{1,50}&lt;/th&gt;)*");
  </code></pre>
  
  <p>But there must be some conceptual piece I'm not getting, because nothing is working. Seems like this should be easy, right?</p>