How to see a text’s “return” key pressed positions?

I am trying to manipulate a text where there are return (Enter) keys pressed. I mean:

"Hey man, how are you?
Here there is one enter above. And pressing 2 enters below.

Ok?"

The manipulated text should look like this: "Hey man, how are you?XHere there is one enter above. And pressing 2 enters below.XXOk?"
I want to detect where those return keys are pressed from a plain text like above, and put a char (i.e “X”) at the place of these positions. Maybe detecting “n” chars where they can be visible? How can this be achieved in js?