Powershell replace command not removing newline

-replace is a regex operator, so you need to supply a valid regular expression pattern as the right-hand side operand.

You can replace most newline sequences with a pattern describing a substring consisting of:

  • an optional carriage return (\r? in regex), followed by
  • a (non-optional) newline character (\n in regex):
$mdbAppText_Arr = $mdbAppText_Arr -replace '\r?\n'