Quantcast
Channel: Match of carriage return, line feed and multiple space in javascript regular expression - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by vks for Match of carriage return, line feed and multiple space in...

\s match any white space character [\r\n\t\f ] You should use \s{2,} for this.It is made for this task.

View Article



Answer by sp00m for Match of carriage return, line feed and multiple space in...

This simple one should suit your needs: /[\r\n ]{2,}/g. Replace by a space.

View Article

Answer by streetturtle for Match of carriage return, line feed and multiple...

This will work: /\n|\s{2,}/g var res = str.replace(/\n|\s{2,}/g, " "); You can test it here: https://regex101.com/r/pQ8zU1/1

View Article

Match of carriage return, line feed and multiple space in javascript regular...

I am trying replace carriage return (\r) and newline (\n) and more than one spaces (' ' ) with single space. I used \W+ which helped to achieve this but, it's replacing special characters also with...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images