I have a Python string and I'm trying to find a regex expression and search/match function which will validate that the string comprises solely one or more instances of a given pattern (i.e match is not None).
The pattern in plain English is "
So for example, valid strings could include:
"P;QTMCFGUART1;W,460800;1;P;QTMCFGUART2;W,460800;1"
"P;QTMCFGUART1;R;2;P;QTMCFGUART2;R;2"
Invalid strings could include:
"P;QTMCFGUART1;W,460800;3;P;QTMCFGUART2;W,460800;1"
"P,QTMCFGUART1,R,P,QTMCFGUART2,R,2"
The regex for a single occurrence of the pattern is simple enough:
r".*;.*;.*;[012];?"
But I'm struggling to find a regex expression and search/match function which validates that the string contains only one or more instances of this pattern. I've tried various combinations of captured group, with and without a global flag, but I can't find one that works for each and every occurrence of the pattern in the string e.g.
r"(.*;.*;.*;[012];?)+"