Greasy Fork is available in English.

Word and Text Replace

Replaces text with other text.

< Feedback on Word and Text Replace

Question/comment

guyRickyAuthor
§
Posted: 2019.06.05.

Slow Regular Expressions

Certain regular expressions may cause the script to run quite slowly such as my bad example of /(.\W?)*/i. This regular expression and others like it may match lines and lines of text instead of just a short word or phrase. What could be done instead is to use the rule /./i, make the "replacing text phrase" unique such as "delete all", and add a conditional that changes the matched text to something else that isn't "delete all". I'll add a console message on the run time of the script for reference if you'd like to see how long it takes to run.

Post reply

Sign in to post a reply.