I am looking to remove multiple line breaks using regular expression. Say I have this text:
"On the Insert tab\n \n\nthe galleries include \n\n items that are designed"
then I want to replace it with
"On the Insert tab\nthe galleries include\nitems that are designed"
So my requirement is:
- it will remove all multiple newlines and will replace with one newline
- It will remove all multiple spaces and will replace with one space
- Spaces will be trimmed as well
I do searched a lot but couldn't find solution - the closest I got was this one Removing redundant line breaks with regular expressions.