(Obsolete) The regex_syntax module, shown in Example 14-35, contains a bunch of flags that can be used to change the behavior of the regex regular expression module.
File: regex-syntax-example-1.py import regex_syntax import regex def compile(pattern, syntax): syntax = regex.set_syntax(syntax) try: pattern = regex.compile(pattern) finally: # restore original syntax regex.set_syntax(syntax) return pattern def compile_awk(pattern): return compile(pattern, regex_syntax.RE_SYNTAX_AWK) def compile_grep(pattern): return compile(pattern, regex_syntax.RE_SYNTAX_GREP) def compile_emacs(pattern): return compile(pattern, regex_syntax.RE_SYNTAX_EMACS)
Core Modules
More Standard Modules
Threads and Processes
Data Representation
File Formats
Mail and News Message Processing
Network Protocols
Internationalization
Multimedia Modules
Data Storage
Tools and Utilities
Platform-Specific Modules
Implementation Support Modules
Other Modules