RegEx find/replace template?

I would like a simple javascript template for doing a regex find and replace search on a draft which I could use and modify to save custom regex workflow actions. I tried modifying existing scripts but I always got error messages. Ideally this template would just have (a) two fields at the top which could be replaced with the regex expressions, and (b) would work either on a selection or (if no selection) on the entire draft.


PS: I also created a feature request to make this easier: A Find/Replace "Step" for Custom Actions (with RegEx)

Hi @luhmann,
I’m a bit late to the party, but made this Drafts action for preview, run, and save of multiple RegExes (I have two other exes as well :wink:

Had the same feature request as you, want to save my regexes as workflows…

So maybe this will help until then: RegEx Factory - Drafts Action.

I believe bbEdit for Mac (with subscription) has something similar called ‘Text Factory’ using Grep/RegEx.

1 Like

Thanks @RoyRogers. I saw this posted to the actions directory and was planning on testing it out soon!