Matching sequentially repeating parentheses with Python Regex
Basically I'm trying to find a series of sequential repetitive patterns using python with a regex:
(X[0-9]+)+
For example, enter the input line:
YYYX4X5Z3X2
Get a list of results:
["X4X5", "X2"]
However, I get instead:
["X5", "X2"]
I checked the regexpal on regexpal and confirmed that it is correct, due to the way python handles the "()" I cannot get the desired result. Can anyone advise?
+3
source to share
3 answers