Consider the following queries:
select
foo,
bar,
yourmom
from
theTable
select top 10 *
from
theTable
select distinct foo, bar + 1, yourmom from theTable
I want a regex query that would extract:
foo,
bar,
yourmom
*
foo, bar + 1, yourmom
respectively.
I tried ^\sselect\s(distinct\s)?(top\s\d*)?(?'columns'.*\s)from[\s.]*$, which I thought would work, but doesn't. I've been playing with it for a while now and I still cannot get it to work in all three test cases. Can someone help me with their regex-fu?