python使用正则表达式解析http url
来源:互联网 发布:dhcp 端口号43端口号 编辑:程序博客网 时间:2024/06/05 19:10
http Get的原文
/alter?user=abcde&pwd=123456
re.compile(r'/(?P<url_path>alter)\?(?P<query>user=(?P<user>[a-zA-Z]{5,10})&pwd=(?P<passwd>(?:\d|\w){6,}?))$')
- step1
(?P<url_path>alter)
找到匹配的http path( alter ),同时命名为url_path
- step2
(?P<query>user=(?P<user>[a-zA-Z]{5,10})&pwd=(?P<passwd>(?:\d|\w){6,}?))
匹配query-string .并命名为query
- step3
user=(?P<user>[a-zA-Z]{5,10})
匹配user
- step4
pwd=(?P<passwd>(?:\d|\w){6,}?)
匹配pwd,其中?为非贪婪模式.
运行结果:
>>> p=re.compile(r'/(?P<url_path>alter)\?(?P<query>user=(?P<user>[a-zA-Z]{5,10})&pwd=(?P<passwd>(?:\d|\w){6,}?))$')>>> p.match('/alter?user=liujxc&pwd=123456').groups()('alter', 'user=liujxc&pwd=123456', 'liujxc', '123456')
0 0
- python使用正则表达式解析http url
- 使用正则表达式解析URL
- 使用正则表达式解析URL
- 使用正则表达式对URL进行解析
- 使用正则表达式解析Url字符串
- 匹配http url 正则表达式
- Python 正则表达式验证URL
- 使用python和正则表达式获取url,及总结
- 匹配URL的正则表达式解析
- 正则表达式完美解析URL中的各部分
- python正则表达式使用
- python使用正则表达式
- python 正则表达式使用
- Python正则表达式使用
- Python开发:正则表达式获得URL
- python 正则表达式判断URL是否合法
- python+正则表达式获取ed2k url
- Python 正则表达式在文本查询URL
- Error running Tomcat 7: Address localhost:1099 is already in use
- 安卓使用WebView清除缓存
- socket数据包限制大小是多少
- hdu5892Resident Evil
- 使用Gson解析复杂的json数据
- python使用正则表达式解析http url
- Java语言的数据类型
- iOS调用系统通讯录(适配iOS9、iOS10)
- linux 常用命令
- Qt的半透明方法总结
- android使用https通信总结
- 常见HTTP状态码
- How to get Android local files URI
- 百度地图 Android SDK - 坐标转换方法