0

String=AUGACGCAUAACCGACGAUGCAGCGGGCAACUAA

I tried

re.findall(r'AUG\w*UAA',string) 

this gives me

"AUGACGCAUAACCGACGAUGCAGCGGGCAACUAA"

i want answer to be

"AUGACGCAUAA"

"AUGCAGCGGGCAACUAA"
RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
Peter
  • 1
  • 1
  • 4
    Use a [non-greedy quantifier](https://docs.python.org/3/library/re.html#index-6): `r'AUG\w*?UAA'`. – Amadan Jan 10 '23 at 04:24
  • Does this answer your question? [Python non-greedy regexes](https://stackoverflow.com/questions/766372/python-non-greedy-regexes) – relent95 Jan 10 '23 at 07:55

0 Answers0