How to run a regex formula on the contents of a draft

Assuming that I work out a regex formula, what is the scripting syntax to apply it to the contents of the current draft ?
thank you

This topic you started recently includes examples of running a regular expression for text substitution on the current draft.

See my first reply to you with the one line script and the subsequent script and action.

Effectively you want to get the draft content and then use a standard JavaScript function that is regular expression aware (such as the replace function for a string, which is what draft content is) on that.

1 Like

OK I understand now. thanks very much
alert(draft.content.replace(/\n^[^#.]./mg, “”));