title: Find all strings starting and ending with given substring in a string using regex in Python
body: <p>I have given a string </p>
  
  <blockquote>
    <p>ATGCCAGGCTAGCTTATTTAA</p>
  </blockquote>
  
  <p>and I have  to find out all substrings in string which starts with ATG and end with either of TAA, TAG, TGA.</p>
  
  <p>Here is what I am doing:</p>
  
  <pre class="lang-py prettyprint-override"><code>seq="ATGCCAGGCTAGCTTATTTAA"
  pattern = re.compile(r"(ATG[ACGT]*(TAG|TAA|TGA))")
  for match in re.finditer(pattern, seq):
      coding = match.group(1)
      print(coding)
  </code></pre>
  
  <p>This code is giving me output:</p>
  
  <blockquote>
    <p>ATGCCAGGCTAGCTTATTTAA</p>
  </blockquote>
  
  <p>But actual output should be :</p>
  
  <blockquote>
    <p>ATGCCAGGCTAGCTTATTTAA, ATGCCAGGCTAG</p>
  </blockquote>
  
  <p>what I should change in my code?</p>