I have the following text sent by the user with breaklines
Text of example in line 1.
(break line)
(break line)
(break line)
The text is very nice...
(break line)
(break line)
The end.
Result expected:
Text of example in line 1.
The text is very nice...
The end.
NOT: Text of example in line 1. The text is very nice... The end.
How I do this in JavaScript(str.replace
) receiving via AJAX in PHP
$text = strip_tags($text, '<br>');
Thank you for answers! But I tested all .. and then I went to see that my DIV is generating HTML codes, I believe that is why it is not working (RegEx). How do I ignore HTML elements to be able to text with line breaks?
`. – Barmar Feb 28 '16 at 03:36
2
3
4
5`. how do I leave only 2 `
`? `1
2
3
4
5` – Fábio Zangirolami Feb 28 '16 at 18:35
){2,}/gi, '
'); tks ;) – Fábio Zangirolami Feb 28 '16 at 18:48