I have some text which looks like this -
\" tushar is a good boy \"
Using javascript I want to remove all the extra white spac
try
var str = " tushar is a good boy "; str = str.replace(/^\s+|\s+$/g,'').replace(/(\s\s\s*)/g, ' ');
first replace is delete leading and trailing spaces of a string.