Python 正则表达式匹配字符串中的http链接
来源:互联网 发布:淘宝法律专业自考通 编辑:程序博客网 时间:2024/05/20 02:55
利用Python正则表达式匹配字符串中的http链接。主要难点是用正则表示出http 链接的模式。
import repattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') # 匹配模式string = 'Its after 12 noon, do you know where your rooftops are? http://tinyurl.com/NYCRooftops 'url = re.findall(pattern,string)print url>>['http://tinyurl.com/NYCRooftops']
阅读全文
0 0
- Python 正则表达式匹配字符串中的http链接
- Python 正则表达式匹配字符串中的日期和时间
- python 字符串匹配与正则表达式
- Python中的正则表达式匹配中文问题
- Python正则表达式处理中文中的匹配
- python中的正则表达式(模式匹配)
- 正则表达式匹配字符串
- 正则表达式匹配 字符串
- 正则表达式匹配字符串
- 字符串正则表达式匹配
- 字符串------正则表达式匹配
- 正则表达式匹配字符串
- 匹配字符串-正则表达式
- python 正则表达式匹配
- Python :正则表达式匹配
- 正则表达式获取字符串中的img标签中的url链接
- python 正则表达式:匹配字符串开头并打印
- python 正则表达式匹配字符串末尾的错误
- Spark Streaming Custom Receivers
- nohup和&后台运行,进程查看及终止
- 例题6-10 UVA699 二叉树先序遍历
- 参数估计与非参数估计
- Gradle系列第(一)篇---Groovy语法初探
- Python 正则表达式匹配字符串中的http链接
- gcov lcov 覆盖c/c++项目入门
- Zookeeper设置开机启动
- C++ 高性能服务器网络框架设计细节
- 数据蒋堂 | 从SQL语法看集合化
- 【面向JS--闭包】
- JAVA远程debug
- laravel的启动过程解析 服务容器Ioc
- UE4材质之图像处理