Module sre
[hide private]
[frames] | no frames]

Module sre

source code

This file is only retained for backwards compatibility.
It will be removed in the future.  sre was moved to re in version 2.5.

Classes [hide private]
error
Functions [hide private]
 
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the string.
 
escape(pattern)
Escape all non-alphanumeric characters in pattern.
 
subn(pattern, repl, string, count=0)
Return a 2-tuple containing (new_string, number).
 
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
 
purge()
Clear the regular expression cache
 
sub(pattern, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl.
 
split(pattern, string, maxsplit=0)
Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings.
 
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning a match object, or None if no match was found.
 
template(pattern, flags=0)
Compile a template pattern, returning a pattern object
 
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning a match object, or None if no match was found.
 
compile(pattern, flags=0)
Compile a regular expression pattern, returning a pattern object.
Variables [hide private]
  LOCALE = 4
  DOTALL = 16
  UNICODE = 32
  I = 2
  M = 8
  L = 4
  IGNORECASE = 2
  S = 16
  U = 32
  X = 64
  VERBOSE = 64
  MULTILINE = 8
Function Details [hide private]

finditer(pattern, string, flags=0)

 
Return an iterator over all non-overlapping matches in the
string.  For each match, the iterator returns a match object.

Empty matches are included in the result.

subn(pattern, repl, string, count=0)

 
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl.  number is the number of
substitutions that were made. repl can be either a string or a
callable; if a callable, it's passed the match object and must
return a replacement string to be used.

findall(pattern, string, flags=0)

 
Return a list of all non-overlapping matches in the string.

If one or more groups are present in the pattern, return a
list of groups; this will be a list of tuples if the pattern
has more than one group.

Empty matches are included in the result.

sub(pattern, repl, string, count=0)

 
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl.  repl can be either a string or a callable;
if a callable, it's passed the match object and must return
a replacement string to be used.