Sha*_*oon 1 javascript php regex
return str.replace(/[\(\)\.\-\s,]/g, "")
Run Code Online (Sandbox Code Playgroud)
return preg_replace('/[\(\)\.\-\s,]/', '', $str);
Run Code Online (Sandbox Code Playgroud)
对于它的价值,大多数反斜杠是不必要的(用两种语言).括号和圆点不需要在字符类中进行转义.如果您愿意,可以将其简化为:
return preg_replace('/[().\-\s,]/', '', $str);
Run Code Online (Sandbox Code Playgroud)