key_equal = key + equal
val = ~key_equal + P.delimitedList(P.Word(P.alphanums), ', ', combine=True)
gr = P.OneOrMore(P.Group(key_equal + val))
print(gr.parseString('ids = 12, 13, 14 fields = name, title'))
Non greedy parsing with pyparsing