import re u = "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" def match_by_re(str): pattern = re.compile(u, re.S) res = pattern.findall(string=str) if res: return res[0]
简介:获取页面参数 原生js: //通过正则匹配获取当前页面的url中的参数 function getUrlParam(name){ var reg = new RegExp("(^|&)"+name+"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); var strValue = ""; if (r!=null){ strVa