REGEX-Escape for: ex.Data["UserMessage"] += $"GetSapTasks()\n";

Your Input:
Result, the escaped string:
ex\.Data\["UserMessage"\] \+\= \$"GetSapTasks\(\)\\n";

What must the escaping look like for:
ex.Data["UserMessage"] += $"GetSapTasks()\n";

The excaped text for use in a regex is:
ex\.Data\["UserMessage"\] \+\= \$"GetSapTasks\(\)\\n";