in reply to regex needed to remove parts of SQL

if you just need to delete 'something-or-other as', something like this may do the trick:

C:\@Work\Perl>perl -wMstrict -e "$_ = shift; my $item = qr{ \w+ \s+ }xms; my $group = qr{ \( [^)]* \) \s* }xms; s{ (?: $item | $group) as }{}xmsgi; print" "SELECT f1 as x1,f2,f3,f4 as x2, (f4= f5) as x3 FROM ...." SELECT x1,f2,f3, x2, x3 FROM ....

if other things may predece 'as', they can be defined and added to the grouped alternation.