I want to be able to capture a repeating group in a single line. I have done my work as shown below;
(((?:\s*^>\s*[0-9]+\s*,\s*[0-9]+\s*,\s*[a-zA-Z]+\s*(,\s*[a-zA-Z]+\s*)*;$\s*)|(?:\s*^>\s*[0-9]+\s*,\s*[0-9]+\s*,\s*[a-zA-Z]+\s*,\s*[0-9]+\s*(,\s*[\-]?[0-9]+\s*)*;$\s*))+)
It captures > 9, 2, door, open;
and > 3, 3, door,1, 1;
individually fine. However, I'd like to capture > 9, 2, door, close; > 1, 9, door, close; > 3, 3, door, 1, 1;
as well. I enclosed my group by using parenthesis with + quantifier at the end, but it does not capture repeating pattern correctly. Could you show me where I did wrong?
EDITED
I made the regex somewhat shorter as follows;
(((\s*>\s*\d+\s*,\s*\d+\s*,\s*\w+\s*(,\s*\w+\s*)*;\s*)|(\s*>\s*\d+\s*,\s*\d+\s*,\s*\w+\s*,\s*\d+\s*(,\s*[\-]?\d+\s*)*;\s*))+)