How can I replace multiple words in a file
-
I need to replace multiple words in a file. I have upto 700 words to replace. we are not sure if all the 700 words are used in that file so we need to check if a used then replace it with another word from list of 700 words we have.
For example we have a list as a below
Car as bus
flight as jet
boat as ship
apple as fruit and so on… -
Something like this maybe:
Find:
(car)|(flight)|(boat)
Replace:(?1bus)(?2jet)(?3ship)
Search mode: Regular expressionYou can do more than 3 items at once; I think you see the pattern.
Note that there is a length restriction of 2046 bytes in the expressions, so you may need to set up more than one set of such replacements.
-
As an alternative, in this post, I shared a script for the PythonScript plugin that allows you to define a list of “translations” – as many as you want. In that example, it was translating from an English term to a foreign language equivalent. However, you could fill out the translation table in the script to do your
car => busandflight => jetconversion.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login