Retrieve the match text (提取获取的字符)
来源:互联网 发布:数码收纳包 知乎 编辑:程序博客网 时间:2024/06/05 04:07
需求:
获取字符串Do you like 12 or 34?中的12
方法:
1. Python
a. Global function
import re
match = re.search(r"\d+", subject)
if match:
result = match.group()
else:
result = ""
b. Compiled object
import re
reobj = re.compile(r"\d+")match = reobj.search(subject)
if match:
result = match.group()
else:
result = ""
2. Tcl
regexp -linestop {\d+} $subject result 0 0
- Retrieve the match text (提取获取的字符)
- 字符的特征提取
- Determine the Position and Length of the Match (获取匹配的起始位置,终止位置,和长度)
- Match Literal Text
- Insert the regex match into the replacement text (插入正则匹配到替换文本中)
- Retrieve a list of all matches (提取所有匹配的列表)
- 提取特定字符的值
- 获取select的text
- Match Previously Matched Text Again (匹配前面匹配的文本)
- 正则中的text()、exec()、match()等的用方法
- Getting the Dimensions of Text:获取文本的长和宽
- Insert Part of the Regex Match into the Replacement Text (将正则匹配插入替换文本中)
- 获取动态textbox的Text
- Robotium获取TextView的Text
- jQuery获取select的text
- sql 提取豆号分格符(,)的字符
- 字符窜中提取中文的方法
- 车牌字符模板特征值的提取方法
- XML概述
- struts处理复选框
- 3G拨号
- arm linux 嵌入式开发常用命令小记
- php基础5---面向对象
- Retrieve the match text (提取获取的字符)
- 利用硬链接和truncate降低drop table对线上环境的影响
- DecodeEditEncodeTest.java
- 给Android应用开发者的十个建议
- PHP基础加强(第十天)
- VirtualBox安装64位的CentOS问题
- 牛人主页
- Advanced Installer10.0中文版完美安装软件教程 msi,exe制作教程
- CentOS Linux更改MySQL数据库目录位置具体操作