Set Regular Expression Options (设置正则表达式选项)
来源:互联网 发布:js隐藏数组里面的input 编辑:程序博客网 时间:2024/06/10 14:09
需求:
free-spacing, case insensitive, dot matches lines breaks, and "^ and $ match at line breaks"
实现
a. Python:
import re
reobj = re.compile("regex pattern",
re.VERBOSE | re.IGNORECASE |
re.DOTALL | re.MULTILINE)
说明:
Free-spacing: re.VERBOSE or re.X
Case insentitive: re.IGNORECASE or re.I
DOt matches line breaks: re.DOTALL or re.S
^ and $ match at line breaks: re.MULTILINE or re.M
补充:
Extra options to change the meaning of word bounaries and the shorthand character classes \w \d \s, as well as their negated counterparts
By default, these tokens deal only with ASCII letters, digits, and whitespace.
re.LOCALE or re.L option makes these tokens dependent on the current locale.
re.UNICODE or re.U makes these tokens dependent on the Unicode standard
b. Tcl
set result [regexp -nocase -lineanchor -expanded {abc} $subject]
说明:
Free-spacing: -expanded
Case insentitive: -nocase
DOt matches line breaks: do not set -linestop
^ and $ match at line breaks: -lineanchor
- Set Regular Expression Options (设置正则表达式选项)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(Regular Expression)
- 正则表达式(regular expression)
- 正则表达式 regular-expression
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式(regular expression)
- 正则表达式,Regular Expression
- 正则表达式-Regular Expression
- 正则表达式 (Regular Expression)
- Linux下MIPS平台交叉编译FFMpeg库 及使用库截取视频中的某一帧
- Block用法
- ios 推送
- Java中使用OpenSSL生成的RSA公私钥进行数据加解密
- C#操作XML小结
- Set Regular Expression Options (设置正则表达式选项)
- 第五届省赛总结
- iPhone开源项目汇总
- KEIL4 ARM调试遇debug无响应
- web页面,网页 调用 iOS的地理位置
- 习近平:党员干部要老老实实干事清清白白为官
- 堆栈管理器
- 正则表达式 提取 html 标签的内容
- iPhone项目例子资源