var string1 = 'ab\nc', string2 = 'abc'; alert(string1 == string2); string1 = string1.replace(/[\f\r\n]/g, ''); alert(string1 == string2);