I want to know if it's possible to return a list of matches with a regex pattern consisting of a specific, consecutively repeating string, e.g. "ADDD". This may sound trivial, in fact according to regexpal.com, it should be as simple as this "(AGATC)\1+":
result in regexpal.com. And using re.findall
, as stated in the documentation, should return a list with all those matches.
However, when using this code:
pattern = r"(AGATC)\\1+"
list_of_results = re.findall(pattern, seq_string)
print("list of results:", list_of_results)
where seq_string
is the string where I'm looking for the pattern and is the same as the one used in the image of regexpal, I get an array of 1 element containing the pattern ('AGATC').
Is it possible to do what I need? Maybe I'm overlooking something?