I have my string like aaadaa and want to search aa in it and return their respective index positions like (0, 1)(1, 2)(4, 5) with start() and end() functions.
import re
sequence = "aaadaa"
query = "aa"
r = re.compile(query)
print([[m.start(),m.end()] for m in r.finditer(sequence)])
It gives me the below output
[[0, 2], [4, 6]]
Obviously i can see from here it invlove the use of lookarounds here can someone give me the regular expresssion or the solution to find such positions.