[英]Javascript RegExp pattern match
Please can anybody tell me how to match this below pattern: 请任何人告诉我如何匹配以下模式:
var pattern = "^(?:http(s)?://)?(www\\.)?google\\..*/.*$";
var str = "https://www.google.co.in";
You'll find a nice example here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match 您将在此处找到一个不错的示例: https : //developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/match
BTW, your regexp seems to ask for a trailing slash. 顺便说一句,您的正则表达式似乎要求用斜杠结尾。
Your sample here: http://regexr.com/3dmu3 您的示例在这里: http : //regexr.com/3dmu3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.