title: Using regex in Python 2.7.3 to search text and output matches
body: <p>I am trying to accomplish exactly what the title says. The program is meant to read a .txt file from a specified path and match the terms specified in the code. This is what I have so far:</p>
  
  <pre><code>import re
  
  source = open("C:\\test.txt", "r")
  lines = []
  
  for line in source:
      line = line.strip()
      lines.append(line)
      if re.search('reply', line):
          print 'found: ', line
  </code></pre>
  
  <p>As you can see, I am specifying the term 'reply' using re.search but this restricts me to one term. I know there is a way to specify a list or dictionary of words to search for, but my attempts have failed. I think it's possible to create a list with something like ...</p>
  
  <pre><code>keywords = ['reply', 'error', 'what'] 
  </code></pre>
  
  <p>... but despite what I've read on this site, I can't seem to incorporate this into the code properly. Any advice or assistance with this is greatly appreciated!</p>
  
  <p>PS. If I wanted to make the search case sensitive, would I be able to use ...</p>
  
  <pre><code>"(.*)(R|r)eply(.*)"
  </code></pre>
  
  <p>... in the list of terms I want to find?</p>