Answers.Body: <p><code>re.search</code> method do not return a simply boolean but a useful object contains many information:</p>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  
  import re
  
  peptide1=&quot;MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG&quot;
  
  re_search_result = re.search(r'L*L*L', peptide1)
  if re_search_result:
      print(&quot;YES&quot;)
      motif_start_position=re_search_result.start()
      motif_end_position=re_search_result.end()
      motif_length = re_search_result.end() - re_search_result.start()
      print(&quot;Motif start at position: %d&quot; % motif_start_position)
      print(&quot;Motif end at position  : %d&quot; % motif_end_position)
      print(&quot;SO length is ......... : %d&quot; % motif_length)
      print(&quot;The motif is : &lt;%s&gt;&quot; % peptide1[motif_start_position:motif_end_position])
  else:
      print(&quot;NO&quot;)
  </code></pre>
  <p>Result is:</p>
  <pre><code>YES
  Motif start at position: 20
  Motif end at position  : 488
  SO length is ......... : 468
  The motif is : &lt;LTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNL&gt;
  </code></pre>
  <p>The motif <code>L*L*L</code> is a quite strange: <code>L</code> zero or many times followed by <code>L</code> zero or many times followed by followed by a <code>L</code>. It's an equivalent of <code>L*L</code>, equivalent of <code>L+</code>.</p>
  <p>Do you search for <code>L.*L.*L</code>, <code>L[^L]*L[^L]*L</code> or simply <code>LLL</code> ?</p>
  <p>Notes:</p>
  <ul>
  <li>When you post code, use block delimited by two ``` (no by two simple `)</li>
  <li>In Python, code indentation is very important, always use spaces (4)</li>
  </ul>
  <hr />
  <p>If you want to loop over all motifs (like strings), use <code>findall</code> method:</p>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  
  import re
  
  peptide1=&quot;MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG&quot;
  
  re_findall_result = re.findall(r'L[^L]*L[^L]*L', peptide1)
  for element in re_findall_result:
      print(&quot;Element: &lt;%s&gt;&quot; % element)
  </code></pre>
  <p>Result will be:</p>
  <pre><code>Element: &lt;LTGALL&gt;
  Element: &lt;LYRDAAVESPQHEVSNESGSTLKEHDYFGL&gt;
  Element: &lt;LNLNESATTL&gt;
  Element: &lt;LGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNIL&gt;
  Element: &lt;LDLKVHL&gt;
  Element: &lt;LSFDNMQGPLNPFFRKSL&gt;
  Element: &lt;LVKIYMDGVPFGRKVDLKTNDSYDKL&gt;
  Element: &lt;LEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFL&gt;
  Element: &lt;LIYEDHEGDSMLVGDVPWEL&gt;
  </code></pre>
  <hr />
  <p>If you want all find objects like with <code>search</code> method, use <code>finditer</code> method:</p>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  
  import re
  
  peptide1=&quot;MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG&quot;
  
  re_findall_result = re.finditer(r'L[^L]*L[^L]*L', peptide1)
  for element in re_findall_result:
      print(&quot;peptide1[%s:%s]=&lt;%s&gt;&quot; % (element.start(), element.end(), peptide1[element.start():element.end()]))
  </code></pre>
  <p>Result will be:</p>
  <pre><code>peptide1[20:26]=&lt;LTGALL&gt;
  peptide1[39:69]=&lt;LYRDAAVESPQHEVSNESGSTLKEHDYFGL&gt;
  peptide1[90:100]=&lt;LNLNESATTL&gt;
  peptide1[101:163]=&lt;LGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNIL&gt;
  peptide1[248:255]=&lt;LDLKVHL&gt;
  peptide1[278:296]=&lt;LSFDNMQGPLNPFFRKSL&gt;
  peptide1[378:404]=&lt;LVKIYMDGVPFGRKVDLKTNDSYDKL&gt;
  peptide1[407:443]=&lt;LEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFL&gt;
  peptide1[449:469]=&lt;LIYEDHEGDSMLVGDVPWEL&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T12:40:10.210Z
Answers.Text: thank you so much.  I have another question, if for example the motif is written as LLxxLxPP, where x can be any amino acid, how must I write it? I think that is one of the things that confuses me
Answers.UserDisplayName: thole
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T12:57:48.823Z
Answers.Text: So if I have LxxLxPP where x can be any amino acid, how must I write it inside the re.finditer ? This is where I get confused
Answers.UserDisplayName: thole
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T13:29:05.917Z
Answers.Text: @thole in regular expressions, `*` means "0 or more of the previous character". To match any character, you want `.`. Also, `[ABC]` means "find either `A` or `B` or `C`". So the actual pattern you want is `r'L.L.L'` but of course that will also match `LLLLL`.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T13:43:27.523Z
Answers.Text: @terdon thank you, that makes a lot of sense. So if I had a motif LxxLxP then it would be r'L..L.P'
Answers.UserDisplayName: thole
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T13:53:16.907Z
Answers.Text: Yes, exactly right @thole.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T14:01:53.723Z
Answers.Text: if you are interested by Regular Expression (RegEx) in Python, see https://www.w3schools.com/python/python_regex.asp
Answers.UserDisplayName: Arnaud Valmary
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T11:36:05.570Z
Answers.LastActivityDate: 2022-11-10T11:36:05.570Z
Answers.UserDisplayName: Arnaud Valmary
Body: <p>I am trying to find some matching motifs on a sequence, as well as the position that the motif is located in and then output that into a fasta file. The code below shows that the motif <code>[L*L*L]</code> is present in the sequence, when I run it returns as &quot;YES&quot; but I do not know where it is positioned.</p>
  <pre class="lang-py prettyprint-override"><code>peptide1=&quot;MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG&quot;
  
  if re.search(r&quot;L*L*L&quot;, peptide1):
      print(&quot;YES&quot;)
  else: 
      print(&quot;NO&quot;)
  </code></pre>
  <p>The code that I wrote to find the position is below, but when I run it says invalid syntax. Could you please assist as I am still new in Bioinformatics, and I have no clue whether in the right track or not.</p>
  <pre class="lang-py prettyprint-override"><code>for position in range(len(peptide1)):
      if peptide1[position:].startswith(re.search(r&quot;L*L*L&quot;)):
          print(position+1)
  </code></pre>
  <p>Lastly once the position of these motifs has been identified, how do I highlight them such that they are visible in the output fasta file.</p>
  <p>I am searching for <code>LxLxL</code> where <code>x</code> can be any amino acid. I used the <code>*</code> to indicate to python that it should use any amino acid, but I think I am incorrect. Could you please assist on how I should actually be writing that motif?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-10T09:00:00.633Z
Comments.Text: What is the actual pattern you are looking for? `L*L*L*` will match anything at all since `L*` means "0 or more L", so it will match `L` but it will also match X or anything else.
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-10T12:48:01.780Z
Comments.Text: @terdon, I am searching for LxLxL where x can be any amino acid. I used the * to indicate to python that it should use any amino acid , but I think I am incorrect. Could you please assist on how I should actually be writing that motif.
Comments.UserDisplayName: thole
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-10T12:59:54.063Z
Comments.Text: @terdon If for example I have a motif LLxxxLxPP, could you please advice on how I am supposed to write it inside re.search or re.finditer? this is where I get confused
Comments.UserDisplayName: thole
Tags: <fasta><python><motifs><sequence>
Title: finding matching motifs in a sequence and their position
ThreadText: # finding matching motifs in a sequence and their position
  
  (Asked by: username_0 on 2022-11-09)
  
  I am trying to find some matching motifs on a sequence, as well as the position that the motif is located in and then output that into a fasta file. The code below shows that the motif `[L*L*L]` is present in the sequence, when I run it returns as "YES" but I do not know where it is positioned.
  
  ```py
  peptide1="MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG"
  
  if re.search(r"L*L*L", peptide1):
      print("YES")
  else: 
      print("NO")
  
  ```
  
  The code that I wrote to find the position is below, but when I run it says invalid syntax. Could you please assist as I am still new in Bioinformatics, and I have no clue whether in the right track or not.
  
  ```py
  for position in range(len(peptide1)):
      if peptide1[position:].startswith(re.search(r"L*L*L")):
          print(position+1)
  
  ```
  
  Lastly once the position of these motifs has been identified, how do I highlight them such that they are visible in the output fasta file.
  
  I am searching for `LxLxL` where `x` can be any amino acid. I used the `*` to indicate to python that it should use any amino acid, but I think I am incorrect. Could you please assist on how I should actually be writing that motif?
  
  **Tags:** fasta, python, motifs, sequence
  
  > **Comments:**
  > **username_1**: What is the actual pattern you are looking for? `L*L*L*` will match anything at all since `L*` means "0 or more L", so it will match `L` but it will also match X or anything else.  
  > **username_0**: @username_1, I am searching for LxLxL where x can be any amino acid. I used the * to indicate to python that it should use any amino acid , but I think I am incorrect. Could you please assist on how I should actually be writing that motif.  
  > **username_0**: @username_1 If for example I have a motif LLxxxLxPP, could you please advice on how I am supposed to write it inside re.search or re.finditer? this is where I get confused  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-11-10. Score: 2
  
  `re.search` method do not return a simply boolean but a useful object contains many information:
  
  ```py
  #! /usr/bin/env python3
  
  import re
  
  peptide1="MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG"
  
  re_search_result = re.search(r'L*L*L', peptide1)
  if re_search_result:
      print("YES")
      motif_start_position=re_search_result.start()
      motif_end_position=re_search_result.end()
      motif_length = re_search_result.end() - re_search_result.start()
      print("Motif start at position: %d" % motif_start_position)
      print("Motif end at position  : %d" % motif_end_position)
      print("SO length is ......... : %d" % motif_length)
      print("The motif is : <%s>" % peptide1[motif_start_position:motif_end_position])
  else:
      print("NO")
  
  ```
  
  Result is:
  
  ```
  YES
  Motif start at position: 20
  Motif end at position  : 488
  SO length is ......... : 468
  The motif is : <LTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNL>
  
  ```
  
  The motif `L*L*L` is a quite strange: `L` zero or many times followed by `L` zero or many times followed by followed by a `L`. It's an equivalent of `L*L`, equivalent of `L+`.
  
  Do you search for `L.*L.*L`, `L[^L]*L[^L]*L` or simply `LLL` ?
  
  Notes:
  
  * When you post code, use block delimited by two ``` (no by two simple `)
  * In Python, code indentation is very important, always use spaces (4)
  
  ---
  
  If you want to loop over all motifs (like strings), use `findall` method:
  
  ```py
  #! /usr/bin/env python3
  
  import re
  
  peptide1="MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG"
  
  re_findall_result = re.findall(r'L[^L]*L[^L]*L', peptide1)
  for element in re_findall_result:
      print("Element: <%s>" % element)
  
  ```
  
  Result will be:
  
  ```
  Element: <LTGALL>
  Element: <LYRDAAVESPQHEVSNESGSTLKEHDYFGL>
  Element: <LNLNESATTL>
  Element: <LGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNIL>
  Element: <LDLKVHL>
  Element: <LSFDNMQGPLNPFFRKSL>
  Element: <LVKIYMDGVPFGRKVDLKTNDSYDKL>
  Element: <LEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFL>
  Element: <LIYEDHEGDSMLVGDVPWEL>
  
  ```
  
  ---
  
  If you want all find objects like with `search` method, use `finditer` method:
  
  ```py
  #! /usr/bin/env python3
  
  import re
  
  peptide1="MKFSNEVVHKSMNITEDCSALTGALLKYSTDKSNMNFETLYRDAAVESPQHEVSNESGSTLKEHDYFGLSEVSSSNSSSGKQPEKCCREELNLNESATTLQLGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNILEEFRAMKAQAHMTKSPKPVHTMQHNMHASFSGAQMAFGGAKNNGVKRVFSEAVGGNHIAASGVGVGVREGNDDVSRCEEMNGTEQLDLKVHLPKGMGMARMAPVSGGQNGSAWRNLSFDNMQGPLNPFFRKSLVSKMPVPDGGDSSANASNDCANRKGMVASPSVQPPPAQNQTVGWPPVKNFNKMNTPAPPASTPARACPSVQRKGASTSSSGNLVKIYMDGVPFGRKVDLKTNDSYDKLYSMLEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFLEGSEYVLIYEDHEGDSMLVGDVPWELFVNAVKRLRIMKGSEQVNLAPKNADPTKVQVAVG"
  
  re_findall_result = re.finditer(r'L[^L]*L[^L]*L', peptide1)
  for element in re_findall_result:
      print("peptide1[%s:%s]=<%s>" % (element.start(), element.end(), peptide1[element.start():element.end()]))
  
  ```
  
  Result will be:
  
  ```
  peptide1[20:26]=<LTGALL>
  peptide1[39:69]=<LYRDAAVESPQHEVSNESGSTLKEHDYFGL>
  peptide1[90:100]=<LNLNESATTL>
  peptide1[101:163]=<LGPPAAVKPSGHADGADAHDEGAGPENPAKRPAHHMQQESLADGRKAAAEMGSFKIQRKNIL>
  peptide1[248:255]=<LDLKVHL>
  peptide1[278:296]=<LSFDNMQGPLNPFFRKSL>
  peptide1[378:404]=<LVKIYMDGVPFGRKVDLKTNDSYDKL>
  peptide1[407:443]=<LEDMFQQYISGQYCGGRSSSSGESHWVASSRKLNFL>
  peptide1[449:469]=<LIYEDHEGDSMLVGDVPWEL>
  
  ```
  
  > **Comments:**
  > **username_0**: thank you so much.  I have another question, if for example the motif is written as LLxxLxPP, where x can be any amino acid, how must I write it? I think that is one of the things that confuses me  
  > **username_0**: So if I have LxxLxPP where x can be any amino acid, how must I write it inside the re.finditer ? This is where I get confused  
  > **username_1**: @username_0 in regular expressions, `*` means "0 or more of the previous character". To match any character, you want `.`. Also, `[ABC]` means "find either `A` or `B` or `C`". So the actual pattern you want is `r'L.L.L'` but of course that will also match `LLLLL`.  
  > **username_0**: @username_1 thank you, that makes a lot of sense. So if I had a motif LxxLxP then it would be r'L..L.P'  
  > **username_1**: Yes, exactly right @username_0.  
  > **username_2**: if you are interested by Regular Expression (RegEx) in Python, see https://www.w3schools.com/python/python_regex.asp  
  
  ---
  
  