i'm trying to create a regex that will replace all white spaces for one, but preserving new lines, is possible?

for example:

```
var text = 'AAAAAAAA'
text += 'AA AA      AAA BB  B  B B B BB B'
text += 'B B';

var text = text.replace(/\s+/g, ' ');
"AAAAAAAAAA AA      AAA BB  B  B B B BB BB B"

```

output:

```
"AAAAAAAAAA AA AAA BB B B B B BB BB B"

```

And i want preserve the lines.

Thanks.