.NODE

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

show all menu





Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net