I have a string of select vars from a SQL query\n\ni.e. Select first, second, third, fourth from table...\n\nI can get the part "first, second, third, fourth" just fine.\n\nI then turn that into a list which is used elsewhere.\n\nMy problem is when someone does this:\n\nSelect first, second AS NumberTwo, third, mytable.fourth from table...\n\nFor the use I have for that srting I grab, the AS and . cause problems.\n\nI can say what I want the regex to do, but I have having a terrible\ntime writing it.\n\nfirst, I'd like one to strip out all text backwards from "AS" until the\nprevious comma (i.e. make ", second AS NumberTwo," just ", NumberTwo,"\n\nsecondly, I'd like one that does the same thing with the period (i.e.\nmake ", mytable.fourth," just ", fourth,"\n\nFinding the "AS" and "." are in grasp, but searching/removing backwards\nuntil the previous "," is a pain at this point.\n\nIs this even possible? Do I need to break my string into chunks at the\ncomma and approach it that way?