Say i want to match such a repeated pattern:
a:b
a:b,c:d
So a comma
separated subsequence pairs s1:s2,s3:s4,....
(no trailing comma allowed), which each subsequence should be non-empty, and can include any ASCII char but not the separator: ,
, and must match the whole string.
In this case how the rust regexp will look like?
CodePudding user response:
I would phrase the pattern as:
[^:,] :[^:,] (?:,[^:,] :[^:,] )*