str = "(" + str.replace(/[^\d.+-*\/()]+/g,"") + ")"; 是什么意思?
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/04 23:36:23
![str =](/uploads/image/z/10176491-11-1.jpg?t=str+%3D+%22%28%22+%2B+str.replace%28%2F%5B%5E%5Cd.%2B-%2A%5C%2F%28%29%5D%2B%2Fg%2C%22%22%29+%2B+%22%29%22%3B+%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D%3F)
str = "(" + str.replace(/[^\d.+-*\/()]+/g,"") + ")"; 是什么意思?
str = "(" + str.replace(/[^\d.+-*\/()]+/g,"") + ")"; 是什么意思?
str = "(" + str.replace(/[^\d.+-*\/()]+/g,"") + ")"; 是什么意思?
str = "(" + str.replace(/[^\d.+-*\/()]+/g,"") + ")" ;
我想是将str 中的不是数字及 + - * / () 及 小数点的字符去掉.然后在套上括号.
但他的正则好像有点问题,稍微改下
var str="asd323+f4345*234.3a";
alert( str.replace(/[^\d\+\.\-\*\/()]+/g,""));
输出 323+4345*234.3