Using flags in RegexReplace?

I’m trying to use RegexReplace in a script step to filter out the end of a string. The problem is there are line breaks at the end of the string, and using the dotall flag (s) would solve it, but I can’t seem to use flags in flowscript. Is this not possible? Whenever I wrap my expression with slashes to add flags it stops working.

Can you paste in some example data of original string and expected output?