search

Home  >  Q&A  >  body text

How to use regular expressions to batch copy and modify strings in vim

Perform batch replacement through vim and generate a script indicating the changes, for example:
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
.....

ringa_leeringa_lee2743 days ago1141

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-05-16 16:44:57

    Using group ("(...)") in vim to implement.
    :%s/aaa_(.*)/alter table aaa_1 rename bbb_1/g

    reply
    0
  • Cancelreply