Using Google apps script, in a google text document (i.e. just a regular documenet), I would like to convert the following string
{ some text | footnote | link }
to
some text
with a footnote attached, and a link added to the text.
So it would be something like this:
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
var myRegexp = new RegExp('\{(.*)\|(.*)\|(.*)\}','g');
body.replaceText(myRegexp, "$1");
followed by adding the footnote and link to the result. I can't get the replaceText to work (and there's a note about capture group support in the documentation).
Would really appreciate some help with a complete recipe on how to do this!