Action
Test Replace
Steps
-
script
// Regular expression to match the pattern "C-CAT (FO), dated March X, YYYY" // It captures the entire date string after "dated" const pattern = /C-CAT \(FO\), dated (\w+ \d+, \d+)/; // Try to match the pattern in the draft content const match = draft.content.match(pattern); if (match && match[1]) { // Extract the date from the match const date = match[1]; // Replace all instances of "dated," with "dated [extracted date]," draft.content = draft.content.replace(/dated,/g, `dated ${date},`); draft.update(); // Provide feedback alert("All instances of 'dated,' have been updated with the dynamic date: " + date); } else { // If the pattern is not found, provide feedback alert("The specific pattern 'C-CAT (FO), dated ...' was not found."); }
Options
-
After Success Nothing Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.