I am using python regular expression (regex) to find all the matches in any string position (say "GgGAT", frame 1 is Gg.. and frame2 is gG..). I need to used re.finditer method. My code below gives me only "Gg"
while I need both "Gg"
and "gG"
;
import re
data="ACGTGgGTT"
for match in re.finditer(r'GG|gg|Gg|gG', data):
print (match)
You can use regex lookahead using ?=...
synthax:
re.finditer(r"(?=(GG|gg|Gg|gG))", data)