How can i remove space in a string, without removing the breaks inside?
$new=$new.replace(/\s+/g,' '); //not working correct
this       is a test.
please    remove only   the
Space not
the       breaks inside
this is a test.
please remove only the
Space not
the breaks
				
                        
Just use
/ +/g: