Embedded for loop with regex
<pre><code>def find_string(header,file_1,counter):
  ab = re.compile(str(header))
  for line in file_1:
    if re.search(ab,line) !=None:
       print line
  counter+=1
  return counter

file_1 = open("text_file_with_headers.txt",'r')
header_array = []
header_array.append("header1")
header_array.append("header2")
# ...

counter = 0
for header in header_array:
  counter = find_string(header,file_1,counter)
</code></pre>

<p>Every time I run this it searches for only one of the headers and I cannot figure out why.</p>
