我的一个页面上有以下RegularExpressionValidator:
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ControlToValidate="InKindTextBox"
ErrorMessage="The value entered for
我在这里使用正则表达式
^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$
在这里工作很好,
但是我的代码不起作用-我使用的是jquery.validate.min.js和其他方法. is
下面的代码适用于其他Regexes,但此代码不起作用,它总是说无效:
var yt = new RegExp("^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\
由于某些原因,js不能将我的字符串与regexp匹配。
href = "/admin/user/manage/621/edit";
var myRegexp = new RegExp("/user\/manage\/([0-9]+)/g");
var match = myRegexp.exec(href);
console.log(match)
尝试了不同的组合,结果仍然是空的。怎么啦?
有人知道为什么在执行这个JS-方法时,我总是在火狐控制台中得到"TypeError: str.match(.)是空的“吗?
function checkBreakPoints() {
var str = '@media only screen and (max-width:2em)';
var patt1 ="/@media[A-z, 0-9, \-,: , ., ), (]*width:/gi";
console.log(str.match(patt1).length);
}
谢谢你的帮忙