I have a variable
There are 3 parts to clean
- 2+ Consecutive spaces should become 1 space, see below
- 2+ Consecutive line breaks should become 2 line breaks, see vertical spacing below
- Tabs should be removed.
The goal is:
summary.replace(/\s\s+/g, ' ');
but it outputted
T he Fox Jumped Over
, which took care of the first part, but totally destroyed the vertical spacing on the second part, as it considers it consecutive spacing. Tabs should also be removed/cleaned up if they exist.
How can I get the goal?
I think I screwed up on part 2, with the # of line breaks, so I updated it. But the goal is what we're after in terms of spacing/formatting.