title: python regex optional capture group
body: <p>I have the following problem matching the needed data from filenames like this:</p>
  
  <pre><code>miniseries.season 1.part 5.720p.avi
  miniseries.part 5.720p.avi
  miniseries.part VII.720p.avi     # episode or season expressed in Roman numerals
  </code></pre>
  
  <p>The "season XX" chunk may or may not be present or may be written in short form, like "s 1" or "seas 1"</p>
  
  <p>In any case I would like to have 4 capture groups giving as output :</p>
  
  <pre><code>group1 : miniseries
  group2 : 1 (or None)
  group3 : 5
  group4 : 720p.avi
  </code></pre>
  
  <p>So I've written a regex like this :</p>
  
  <pre><code>(^.*)\Ws[eason ]*(\d{1,2}|[ivxlcdm]{1,5})\Wp[art ]*(\d{1,2}|[ivxlcdm]{1,5})\W(.*$)
  </code></pre>
  
  <p>This only works when i have a fully specified filename, including the optional "season XX" string.
  Is it possible to write a regex that returns "None" as group2 if "season" is not found ?</p>