开发者

using serverside regular expression in javascript

I am validating website by writing serverside regular expression when i copy the same

thing in javascript and try to validate its not happening a part of my c开发者_高级运维ode is as follows

"^(https://)+\w+\.+\w" - //serverside validation working fine
document.getElementById('txtWebsite').value.match("^(https://)+\w+\.+\w") == null

how can i implement the same in client side validation


String.match is considering you regex as String and not as a RegExp object. Try this:

document.getElementById('txtWebsite').value.match(/^(https:\/\/)+\w+\.+\w/)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜