Sublime Forum

Batch search and replace multiple strings at once?


I basically want to batch search/replace files with a few things. For example, if I have a big list with 3 strings, but I want to search and replace 3 found items with another 3 items.

mylist = [stuff, thing, stuff, things, thing]

All the “stuff” items would get replaced with another specified string. Same for the other items. Like:

mylist2 = [one, three, one, two, three]

I hope this makes sense. I’d rather not have to search/replace these terms one by one (I have a lot of terms in the file that need to be replaced with a lot of other terms.) I’m a beginner and any help would be appreciated!



The RegReplace package solved this problem for me. You can install it using Package Control.

If you look at the user guide online, what you’re after is “Chained replacements in one command”. You’d want to make three commands, like stuff_to_one, things_to_two, and thing_to_three, then chain those in the “replacements” array.



There is also a quickstart guide available here: It is supposed to be available from the menu when you install RegReplace, but I still can’t make the release because I am waiting for Package Control to merge a new dependency addition :frowning:. May have to disable the new features just to get a release out…



Would be great if this could be included right within ST. I guess it could be quite the basic feature.