title: Using PIG with Hadoop, how do I regex match parts of text with an unknown number of groups?
body: <p>I'm using Amazon's elastic map reduce.</p>
  
  <p>I have log files that look something like this</p>
  
  <pre><code>   random text foo="1" more random text foo="2"
     more text notamatch="5" noise foo="1"
     blah blah blah foo="1" blah blah foo="3" blah blah foo="4" ...
  </code></pre>
  
  <p>How can I write a pig expression to pick out all the numbers in the 'foo' expressions?</p>
  
  <p>I prefer tuples that look something like this:</p>
  
  <pre><code>(1,2)
  (1)
  (1,3,4)
  </code></pre>
  
  <p>I've tried the following:</p>
  
  <pre><code>TUPLES = foreach LINES generate FLATTEN(EXTRACT(line,'foo="([0-9]+)"'));
  </code></pre>
  
  <p>But this yields only the first match in each line:</p>
  
  <pre><code>(1)
  (1)
  (1)
  </code></pre>