I saw some examples of this here but it did not answer my question: Python Regular Expression findall with variable
i'm trying to use a variable instead of the 9 but i can't seem to figure it out
value = 9
ORF = re.findall(r'ATG(?:(?!TAA|TAG|TGA)…){ value ,}?(?:TAA|TAG|TGA)',seq)
#obviously doesn't work or i wouldn't have made this post
I tried:
value = 9
ORF = re.findall(r'ATG(?:(?!TAA|TAG|TGA)…){ {} ,}?(?:TAA|TAG|TGA)'.format(value),seq)
but got the error:
ValueError: Single '}' encountered in format string
then I tried:
value = r'{}'.format(9)
ORF = re.findall(r'ATG(?:(?!TAA|TAG|TGA)...){value,}?(?:TAA|TAG|TGA)',seq)
and got no error but it didn't work when i looked downstream
How can I get this variable to work in my regular expression?