ure – 正则表达式¶
该模块实现相应CPython模块的子集,如下所示。更多信息,请参见
This module implements a subset of the corresponding CPython module,
as described below. For more information, refer to the original
CPython documentation: re.
该模块实现正则表达式操作。支持的正则表达式语法是CPython re 模块的一个子集(实际上是POSIX扩展正则表达式的子集)。
支持运营商为:
'.'- 匹配任何字符。
'[]'- 匹配字符集。支持单个字符和范围。
'^'
'$'
'?'
'*'
'+'
'??'
'*?'
'+?'
'()'- Grouping. Each group is capturing (a substring it captures can be accessed
with
match.group()method).
不支持计数重复({m,n})、更高级断言、名称组等。
函数¶
-
ure.search(regex_str, string)¶ 在
string中搜索 正则表达式对象 。与match不同,这将首先搜索与正则表达式相匹配的字符串(若正则表达式固定,则字符串为0)。
-
ure.DEBUG¶ 标记值,显示有关已编译表达式的调试信息。