The regex_syntax Module

(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.

Example 14-35. Using the regex_syntax Module

import regex_syntax
import regex

def compile(pattern, syntax):
 syntax = regex.set_syntax(syntax)
 pattern = regex.compile(pattern)
 # restore original 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


Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules

Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh © 2008-2020.
If you may any questions please contact us: