在Python中使用正则表达式
Python 的HowTo 文档Regular Expression HOWTO是学习Python 正则表达式的最佳参考. 现在还没有中文版. 有时间我希望能把它翻译成中文版. 这篇文档在Python的自带文档中也有.
这里是几个我看文档的新得:
这是Regular Expression HOWTO所有的章节:
Contents
1 Introduction
2 Simple Patterns
2.1 Matching Characters
2.2 Repeating Things
3 Using Regular Expressions
3.1 Compiling Regular Expressions
3.2 The Backslash Plague
3.3 Performing Matches
3.4 Module-Level Functions
3.5 Compilation Flags
4 More Pattern Power
4.1 More Metacharacters
4.2 Grouping
4.3 Non-capturing and Named Groups
4.4 Lookahead Assertions
5 Modifying Strings
5.1 Splitting Strings
5.2 Search and Replace
6 Common Problems
6.1 Use String Methods
6.2 match() versus search()
6.3 Greedy versus Non-Greedy
6.4 Not Using re.VERBOSE
7 Feedback
About this document ...
没有评论:
发表评论