var string = 'jhweifj"abc"ioweuf\nweuf"123"idcqwuw8wu8'; var regexp = /"[^"]+"/g; string = string.replace(regexp, "---"); alert(string);