正则表达式取querystring

var s = decodeURIComponent((new RegExp('[?|&]userid=([^&;]+?)(&|#|;|$)').exec(location.href || [''])[1].replace('/+/g','%20'))||null);
console.log(s);
原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/8410838.html