http://qs321.pair.com?node_id=662879

jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

What started as a simple exercise, has now gone beyond my (regex) knowledge.
I need to split the following on ',':
$part_sql = "f1,f2, SUM(f3),CONCAT(f4,f5, f6), f7"
The problem is that I don't want to split the stuff inside the CONCAT.
Firts I thought that it was easy, like
my @fields = split(/(?<!\([^\)]+),/, $part_sql);
This raised the following error
Variable length lookbehind not implemented in regex; marked by <-- HER +E in m/(?<!\([^\)]+), <-- HERE / ....
Is there a regex that can do this, or should I do it just differently ?

Cheers
LuCa

Update: from the answers I get the impression that a SQL-parser-module would be the best solution, but for now I choose the quick solution provided by martin.
Thnx for all the suggestion!!