var pattern=/[`~!@#$^\-&*()=|{}':;',\\\[\]\.<>\/?~!@#¥……&*()——|{}【】';:""'。,、?\s]/g; //string = string.replace(pattern,""); var Str = '替换?字*符串/中的所\有特"殊:字<符(包>含空|格' var out = Str.replace(pattern,""); alert(out)