title: Python - can you use re.compile looking for two strings?
body: <p>I am using python 2.7 and have a this in my code: <code>regexp = re.compile('ttp_ws_sm_(\d)_')</code></p>
  
  <p>That searches in my loop for different characters as in my sample (after the third underscore). I need to also do the same for strings like <code>'ttpv1_(\d+)_'</code></p>
  
  <p>The two things I have tried are:</p>
  
  <pre><code>regexp = re.compile('ttp_ws_sm_(\d)_' or 'ttpv1_(\d+)_')
  </code></pre>
  
  <p>and</p>
  
  <pre><code>name = ('ttp_ws_sm_(\d+)_' or 'ttpv1_(\d+)_')
  regexp = re.compile(name)
  </code></pre>
  
  <p>Here's some example data:</p>
  
  <pre><code>sample filheader row
  date,ttp_ws_sm_001_01, , , , , , , , , , , ,117
  date,ttp_ws_sm_001_blank, , , , , , , , , , , ,31
  date,ttp_ws_sm_045_01, , , , , , , , , , , ,145
  date,ttp_ws_sm_045_blank, , , , , , , , , , , ,55
  date,ttp_ws_sm_057_blank, , , , , , , , , , , ,98
  date,ttpv1_001_, , , , , , , , , , , ,67
  date,ttpv1_001_01, , , , , , , , , , , ,67*e is 
  </code></pre>
  
  <p>complete code is:</p>
  
  <pre><code>from collections import defaultdict
  
  import sys
  import csv
  import re
  import os
  
  #variables
  output_path = '\\\\Isfs\\data$\\GIS Carto\TTP_Draw_Count'
  source = '\\\\Isfs\\data$\\GIS Carto\TTP_Draw_Count'
  name = ('ttp_ws_sm_(\d+)_' or 'ttpv1_(\d+)_')
  
  def main():
      result = defaultdict(int)
      regexp = re.compile(name)
  
      with open(os.path.join(source, 'TTP_13_08.csv'), 'r') as f:
          rows = csv.reader(f)
  
          for row in rows:
              match = regexp.search(row[1])
              if match:
                  result[match.group(1)] += int(row[13])
  
      for key, value in result.items():
  
           print ("Club %s %s" % (key, value))
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>If I don't use name and just put either of both strings in the compile statement I only return one set of totals. I need to have both sets combine and print for "001", '045'</p>