I’m having trouble crafting the appropriate find/replace regex to use in Vim.
Here’s some SQL:
select avg(field_name1), avg(field_name2), avg(field_name3) from a_table
Oops, I forgot to alias the results:
select avg(field_name1) field_name1,
avg(field_name2) field_name2, avg(field_name3) field_name3 from a_table
So, in Vim, I’m sure there’s a handy find and replace to match an arbitrary [a-z]\+_[a-z]\+ inside parenthesis, but I can’t figure out how to put that token after the entire match
Try the following: