Example script showing how to create a saved regular expression replace action. Edit the regular expression and replaceWith variables at the top to modify for different saved replacement function.
// define regex to use... const findRegex = /([A-Za-z]*) ([A-Za-z]*)/g; // define replacement expression... const replaceWith = "$2 $1"; // do the replacement... draft.content = draft.content.replace(findRegex, replaceWith); draft.update();
Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.