我现在的标准可以识别免费的电话号码,我想做的是查找那些不是免费的电话号码。以下是我的当前代码:
if ( phoneNumbers.match(/^(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})$/) && data.results[i].duration > 90 && data.results[i].disposition === "ANSWERED") {
console.log(phoneNumbers);
}
我试过以下几种说法:
/^(\+?!1)?!(8(00|44|55|66|77|88)[2-9]\d{6})$/
if ( phoneNumbers/not().match(/^(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})$/) && data.results[i].duration > 90 && data.results[i].disposition === "ANSWERED") {
console.log(phoneNumbers);
}
但这似乎也行不通。它甚至有可能查找一个正则表达式的逆?
发布于 2016-01-23 13:13:33
您想要在javascript中使用的任何条件都可以用!
“反转”。
if(condition){
//Here you do something if the condition is true
}
if(!condition){
//Here you do something if the condition is false
}
在你的飞船里
if(phoneNumbers.match(/^(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})$/)){
//Here you have a toll free
}
if(!phoneNumbers.match(/^(\+?1)?(8(00|44|55|66|77|88)[2-9]\d{6})$/)){
//Here you have a NO toll free
}
https://stackoverflow.com/questions/34963669
复制相似问题