in reply to Pull info from select clause.

If you've got reasonable control over what SQL you have to handle, you could try first excising the text between matching pairs of parentheses, innermost first, eg
$sql = 'a=f(g(1,2),h(3,4,5),6), b=h(1)'; 1 while $sql =~ s/ \( [^(]*? \) //x; print $sql, "\n";
which outputs
a=f, b=h

Replies are listed 'Best First'.
Re: Re: Pull info from select clause.
by the_0ne (Pilgrim) on May 12, 2004 at 01:34 UTC
    That's exactly what I was looking for dave_the_m. Thanks for pointing me in the right direction. I just could not figure out how to do that with a split. That was my problem, I was trying a split alone without looping through the sql string and pulling out individual parts, which is what your while loop does. Thanks again.