title: python - How to use regex to delimit input
body: <p>Say I'm reading directly from an HTML document in my code. Each line looks something like the following:</p>
  
  <pre><code>&lt;TD&gt;field1&lt;/TD&gt;&lt;TD&gt;&lt;A HREF="http://sample.url.com"&gt;field2&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;field3&lt;/EM&gt;&lt;/TD&gt;
  </code></pre>
  
  <p>I want to write code that can easily pick out the fields <code>field1</code>, <code>field2</code>, and <code>field3</code>. I know that every single line of this table is going to be the exact same format, besides each of these fields. </p>
  
  <p>I'm not that familiar with regex, but in my research I've only ever seen it used for <em>searching</em> for known tokens amongst unknown tokens, rather than <em>isolating</em> unknown tokens among known tokens. Due to my inexperience with regex my example will essentially follow the pattern of a C string formatter (using <code>%s</code> for an input token). </p>
  
  <p>So basically, I want to be able to implement the following method with regex:</p>
  
  <pre><code>(field1, url, field2, field3) = regex_extract('&lt;TD&gt;%s&lt;/TD&gt;&lt;TD&gt;&lt;A HREF="%s"&gt;%s&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;%s&lt;/EM&gt;&lt;/TD&gt;')
  </code></pre>
  
  <p>Is this a thing that's possible with regex?</p>