I'm trying to run a regular expression on a string, print some index values, and also print the pattern and the number of times it is encountered. I have an idea of the code I'd like to use but I'm running into some syntax issues. Would appreciate any input.
- 'orfPattern' is a regular expression searching for codons in a string of gene text
- 'text' is a variable that holds text from a text file
orfPattern = 'ATG(...)*?(TAG|TGA|TTA)' orf = re.compile( orfPattern ) def displaymatch(): # orf_pattern = search('ATG(...)*?[(TAG)(TGA)(TTA)]', text) for orf in text do print string.find(s, sub[, start[, end]]) print string.rfind(s, sub[, start[, end]]) print len(text) print orf_pattern countOrf=countOrf+1 done print countOrf