sou*_*der 2 javascript regex string-matching
我正在浏览一段代码而且我遇到了这种语法
str.replace(re,function(raw, p1, p2, p3){
if (!/\/\//.test(p1)) { // <---- this one
//some more code
}
});
Run Code Online (Sandbox Code Playgroud)
我知道测试方法将一个字符串与另一个字符串匹配,并检查它是否存在.但这个正则表达式/\/\//匹配字符串是什么?我检查了正则表达式,然后
\/ matches the character / literally
\/ matches the character / literally
做什么if(!//.test(p1))呢?