Lexer Error: Unexpected token '\' while using .replace() with regex

I get this error while using regex in the .replace() function.

Lexer Error: Unexpected token '\' at column 115 in expression [payload.parts[0].parts.where(`mimeType`, 'text/html' , '==' )[0].body.data.decodeBase64().toString().replace((body \{[\s\S]*?\}),'new text')]

Here is my code on the page

<div dmx-html="payload.parts[0].parts.where(`mimeType`, 'text/html' , '==' )[0].body.data.decodeBase64().replace((body \{[\s\S]*?\}),'')">
</div>

I figured this out. I had to add the forward slashes to indicate it was a regex.

.replace(/(body {[\s\S]*?})/g,'replacement text here')