How to Batch Copy and Modify Strings with Regular Expressions in vim

  question, vim

Batch replacement through vim generates scripts indicating changes, such as:
aaa_table1 -> alter table aaa_table1 rename bbb_table1
aaa_table2 -> alter table aaa_table2 rename bbb_table2
aaa_table3 -> alter table aaa_table3 rename bbb_table3
…..

Implemented with group(“\(…\) “) in vim.
:%s/aaa_\(.*\)/alter table aaa_\1 rename bbb_\1/g