I know there are many similar questions and answers out there but I have had no luck.
I simply want to run a regex on a Google Doc and have it replace what it finds with Uppercase. I have a working regular expression, and a simple string replace works, but I can't get a regex of any kind to work. What am I doing wrong?
function searchAndReplace() {
var bodyElement = DocumentApp.getActiveDocument().getBody();
var regExp = new RegExp(/[\n][\n]([^\n]+)[\n][^\n|\s]/gim);
bodyElement.replaceText(regExp, '$1'.toUpperCase());
}