After implementing this function, I noticed that it is removing the last character of the string. However, the intended functionality was to only replace line breaks with
tags. What could be causing this issue?
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, breakTag);