Can I substitute multiple items in a single regular expression in VIM or Perl?
You can do this in vim using a Dictionary: :%s/quick\|lazy/\={‘quick’:’slow’,’lazy’:’energetic’}[submatch(0)]/g This will change the following text: The quick brown fox ran quickly next to the lazy brook. into: The slow brown fox ran slowly next to the energetic brook. To see how this works, see :help sub-replace-expression and :help Dictionary. In short, \= lets you … Read more