python正则表达式常用
>>> import re>>> re.__all__['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'findall', \'finditer', 'compile', 'purge', 'template', 'escape', 'error', 'Pattern', \'Match', 'A', 'I', 'L', 'M', 'S', 'X', 'U', 'ASCII', 'IGNORECASE', \'LOCALE', 'MULTILINE', 'DOTALL', 'VERBOSE', 'UNICODE']
主要经常用到的有:
match(), fullmatch(), search(), sub(), split(),findall(),finditer(),compile()。其中频率最高的几个是search(),sub(),split(),findall()。
详细用法请help(re.xxx)。
关于正则表达式
本文只作速查,详细请看高手的参考资料。
参考资料:/tutorials/regex/regex.htm