const dummyText = `First line
Second line
Third line
Last Line`
const expectedOutput = `First Line
Second line
Third line
Last Line`
dummyText.replace(/ +?/g, ''), this regex currently replacing all the spaces in between words. I need to remove spaces start and end of the string, have to preserve newline
Below output currently I'm getting
FirstLine Secondline Thirdline LastLine
I need output like expectedOutput variable value