0
当使用有效格式的URL(我使用this网站进行了测试,并且作为真正的匹配项)进行测试时,此RegEx-文字功能块始终返回false。URL匹配正则表达式返回始终为假
function checkRegex (input) {
var re = /^(https?:\/\/)?([\da-z\.-]+)\.([\da-z\.]{2,6})([\/w\.-]+)([\d\w\%\&\_\-\=\?]\/*)*$/i;
return re.test(input);
}
我使用的是作为测试的字符串是:https://google.com.net/ruefqij?random=true&rand2=false
它返回true:http://jsfiddle.net/kweegkk7/ –
@stribizhev这很奇怪。我想这与输入不是干净的或类似的东西有关。 – SemiViral