import re
strings = [r'foo-bar=369,337,234,123', r'foo-bar=369\,337\,234,123']
rx = re.compile(r"[\w+;-]+(?:\\,[\w+;-]+)*", re.A)
for s in strings:
print(f"Parsing {s}")
print(rx.findall(s))
aW1wb3J0IHJlCnN0cmluZ3MgPSBbcidmb28tYmFyPTM2OSwzMzcsMjM0LDEyMycsIHInZm9vLWJhcj0zNjlcLDMzN1wsMjM0LDEyMyddCnJ4ID0gcmUuY29tcGlsZShyIltcdys7LV0rKD86XFwsW1x3KzstXSspKiIsIHJlLkEpCmZvciBzIGluIHN0cmluZ3M6CglwcmludChmIlBhcnNpbmcge3N9IikKCXByaW50KHJ4LmZpbmRhbGwocykp
Parsing foo-bar=369,337,234,123
['foo-bar', '369', '337', '234', '123']
Parsing foo-bar=369\,337\,234,123
['foo-bar', '369\\,337\\,234', '123']