Hi, i wonder if it's possible to make a RegEx for the following data pattern:
'152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.'
string = '152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.'
I am using this Regular Expression (Using Python's re module) to extract these names:
re.findall(r'(\d+): (.+), (.+), (.+), (.+).', string, re.M | re.S)
Result:
[('152', 'Ashkenazi A', 'Benlifer A', 'Korenblit J', 'Silberstein SD')]
Now trying with a different number (less than 4 or more than 4) of name data pattern doesn't work anymore because the RegEx expects to find only 4 of them:
(.+), (.+), (.+), (.+).
I can't find a way to generalize this pattern.