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