Super NOOB to Python (2.4.3): I am executing a function containing a regular expression which searches through a txt file that I'm importing. I am able to read and run re.search on the text file and the output is correct. I need to fun this for multiple occurrences. The regex occurs 48 times in the text). The code is as follows:

!/usr/bin/python
================

import re

dataRead = open('pd\_usage\_14-04-23.txt', 'r')
dataWrite = open('test\_write.txt', 'w')

text = (dataRead.read()) #reads and initializes text for conversion to string
s = str(text) #converts text to string for reading

def user(str):

```
    re1='((?:[a-z][a-z]+))' # Word 1
    re2='(\\s+)'    # White Space 1
    re3='((?:[a-z][a-z]+))' # Word 2
    re4='(\\s+)'    # White Space 2
    re5='((?:[a-z][a-z]*[0-9]+[a-z0-9]*))'  # Alphanum 1

    rg = re.compile(re1+re2+re3+re4+re5,re.IGNORECASE|re.DOTALL)
    #alphanum1=rg.group(5)
    re.findall(rg, s, flags=0)
    #print "("+alphanum1+")"+"\n"

    #if m:
        #word1=m.group(1)
        #ws1=m.group(2)
        #word2=m.group(3)
        #ws2=m.group(4)
        #alphanum1=m.group(5)
        #print "("+alphanum1+")"+"\n"

    return

```

user(s)

dataRead.close()
dataWrite.close()

OUTPUT: g706454

THIS OUTPUT IS CORRECT! BUT...!
I need to run it multiple times reading text thats further down.

I have 2 other definitions that need to be ran multiple times also. I need all 3 to run consecutively, and then run again but starting with the next line or something to search and output newer data. All the logic I tried implement returns the same output. 

So I have something like this:
for count in range (0,47):
 if stop\_read:
 date(s)
 usage(s)
 user(s)

stop\_read is a definition that finds the next line after the data that I'm looking for (date, usage, user). I figured I could call this to say If you hit stop\_read, read the next line and run definitions all over again. 

Any help is greatly appreciated!