Python_API_String Services_re.compile
2012-04-05 18:11
549 查看
API文档:
re.compile(pattern[, flags])
Compile a regular expression pattern into a regular expression object, which can be used for matching using its match() and search() methods, described below.
The expression’s behaviour can be modified by specifying a flags value. Values can be any of the following variables, combined using bitwise OR (the | operator).
翻译文档:
参数:
pattern:正则表达式字符串
[flags]:标志对正则表达式进行小处理
描述:
方法返回一个正则表达式对象,可直接调用match()和search()方法
例子:
#! /usr/bin/env python
#coding=utf-8
import re
patternRe = re.compile('^AA')
print patternRe.search('AAbbb')
输出:
<_sre.SRE_Match object at 0x016490C8>
re.compile(pattern[, flags])
Compile a regular expression pattern into a regular expression object, which can be used for matching using its match() and search() methods, described below.
The expression’s behaviour can be modified by specifying a flags value. Values can be any of the following variables, combined using bitwise OR (the | operator).
翻译文档:
参数:
pattern:正则表达式字符串
[flags]:标志对正则表达式进行小处理
描述:
方法返回一个正则表达式对象,可直接调用match()和search()方法
例子:
#! /usr/bin/env python
#coding=utf-8
import re
patternRe = re.compile('^AA')
print patternRe.search('AAbbb')
输出:
<_sre.SRE_Match object at 0x016490C8>
相关文章推荐
- Python_API_String Services_re.sub
- python(23)re函数:compile、match、search、findall
- Python正则之预编译表达式re.compile()
- Python中正则表达式re模块-compile()和findall()
- python 中的 re.compile 函数
- Python中正则模块re.compile、re.match及re.search函数用法
- Python 正则 re.compile
- Python_API_String Services_string.split
- python正则表达式 re (二)compile
- python re.compile(?P<name>)
- python re.compile()和findall()
- Python_API_String Services_string.find
- Python_API_String Services_string.lower
- python中,有关正则表达式re函数:compile、match、search、findall
- python3用BeautifulSoup用re.compile来匹配需要抓取的href地址
- python-正则re-match-split-sub-subn-compile-finditer-
- Python_API_String Services_string.strip
- Python_API_String Services_string.upper
- Python 正则表达式_re模块_使用compile加速
- Python: re.compile()