var s = decodeURIComponent((new RegExp('[?|&]userid=([^&;]+?)(&|#|;|$)').exec(location.href || [''])[1].replace('/\+/g','%20'))||null);
console.log(s);

正则表达式取querystring的更多相关文章

  1. Java使用正则表达式取网页中的一段内容(以取Js方法为例)

    关于正则表达式: 表1.常用的元字符 代码 说明 . 匹配除换行符以外的任意字符 \w 匹配字母或数字或下划线或汉字 \s 匹配任意的空白符 \d 匹配数字 \b 匹配单词的开始或结束 ^ 匹配字符串 ...

  2. 二、postman断言及正则表达式取值

    postman老式断言与新式断言总结:本文以微信开发者文档为例 断言处如图所示 一.老式断言 老式断言总结:var variables相当于代码中定义的变量,test['']=true;相当于pyth ...

  3. php正则表达式取子字符串及替换

    最近在学习如何用php编写cms,想把文章中的第一个图片提取出来当做缩略图显示到前面,想到的方法就是把文章内容作为一个大字符串,然后用正则表达式找出匹配出第一次出现<img src=" ...

  4. java正则表达式取括号里面的内容

    public static String changeCompName(String compName){ String NewCompName=""; //cm1230NHL6X ...

  5. c# 正则表达式取值、替换

    //例如我想把如下格式记录中的NAME值修改为WANG string line = "ADDR=1234;NAME=ZHANG;PHONE=6789"; Regex reg = n ...

  6. js正则表达式取{}中的值

    var reg = /[^\{}]*\{(.*)\}[^\}]*/; var str = "1111{122}"; console.log(str.replace(reg,'$1' ...

  7. javascript取querystring,存储为hash

    function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location ...

  8. Python 正则表达式取值

    import re class Retest: def __init__(self,string,path): self.string = string self.path = path def re ...

  9. js 正则表达式 取反

    http://www.w3school.com.cn/jsref/jsref_obj_regexp.asp 以匹配中文为例 const test_value = '李钊鸿' if (/[^\u4e00 ...

随机推荐

  1. 3D HTML5 Logo标志 超炫酷旋转特效

    今天又要为大家带来一款超酷的HTML5 Canvas 3D动画特效,是一款可以旋转的HTML5 Logo标志.画面上一共有两块可旋转的区域,第一是可旋转的背景,第二则是可旋转的Logo标志.Logo标 ...

  2. Spock集成入门

    本文基于SpringBoot 在pom.xml添加Spock依赖 <!-- test --> <dependency> <groupId>org.codehaus. ...

  3. “A configuration with this name already exists” error in eclipse run configurations

    “A configuration with this name already exists” error in eclipse run configurations Is there a way t ...

  4. git绑定两个远程仓库

    最近在做公司项目,之前公司项目统一托管在codding 码云,最近我想把项目与自己的gitlab私人仓库再连接一下,作为自己作品收录的地方,这里总结一下用到的git命令及问题. 1.首先, 找到当前已 ...

  5. Python多线程运行带多个参数的函数

    在python中经常会到用多线程处理某个函数来缩短运行时间. from multiprocessing import Pool def work(x): return x+1 pool = Pool( ...

  6. Docker Engine和Docker Machine介绍

    https://blog.csdn.net/u012460749/article/details/78751128

  7. 8 -- 深入使用Spring -- 8... Spring整合Hibernate

    8.8 Spring整合Hibernate 8.8.1 Spring提供的DAO支持 8.8.2 管理Hibernate的SessionFactory 8.8.3 实现DAO组件的基类 8.8.4 传 ...

  8. window.location.href

    WEB设置首页 <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-f ...

  9. 把mongodb服务添加到系统服务中,报错:[sc] openscmanager 失败 5

    添加mongodb系统服务命令如下: sc create MongoDB binPath= "D:\MongoDB\bin\mongod.exe --service --dbpath D:\ ...

  10. Springboot启动后报错【This application has no explicit mapping for /error, so you are seeing this as a fallback····】

    This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Dec 1 ...