我正在尝试使用以下代码从客户投诉文本区域中删除除标点之外的所有特殊字符:
var tmp = complaint;
complaint = new RegExp(tmp.replace(/[^a-zA-Z,.!?\d\s:]/gi, ''));
但它在消毒后一直将“/”放在字符串的前面和后面。
例子:
Hi, I h@ve a% probl&em wit#h (one) of your products.
出来是这样的
/Hi, I have a problem with one of your products./
我想
Hi, I have a problem with one of your products.
提前感谢您提供的任何帮助。