the_0ne has asked for the wisdom of the Perl Monks concerning the following question:
Here is my problem. I want to then split out the First and Last as headers in an array. The above example is simple as splitting on the comma. But when I get to examples like this...$sql = qq| select 'First' = first_name, 'Last' = last_name from table |; # I pull the info from the select clause like this... $sql =~ /select(.*?)from/i; # Then split on comma. @select = split (/,/, $1);
As you probably noticed, the comma inside the coalesce will mess with my split. So, I guess what I want to do is split on the commas, as long as they are not contained inside a set of parenthesis. I am lost on how to accomplish this with a regex. Any help would be greatly appreciated.$sql = qq| select 'First' = coalesce(first_name, ''), 'Last' = coalesce(last_name, '') from table |;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pull info from select clause.
by Fletch (Bishop) on May 11, 2004 at 20:36 UTC | |
|
Re: Pull info from select clause.
by dave_the_m (Monsignor) on May 11, 2004 at 21:41 UTC | |
by the_0ne (Pilgrim) on May 12, 2004 at 01:34 UTC | |
|
Re: Pull info from select clause.
by PodMaster (Abbot) on May 11, 2004 at 20:48 UTC | |
|
Re: Pull info from select clause.
by the_0ne (Pilgrim) on May 11, 2004 at 20:57 UTC |