Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | search |
def | match |
def | sub |
def | subn |
def | split |
def | findall |
def | __getinitargs__ |
def | __getstate__ |
def | __setstate__ |
Data Fields | |
code | |
flags | |
pattern | |
groupindex | |
Holds a compiled regular expression pattern. Methods: match Match the pattern to the beginning of a string. search Search a string for the presence of the pattern. sub Substitute occurrences of the pattern found in a string. subn Same as sub, but also return the number of substitutions made. split Split a string by the occurrences of the pattern. findall Find all occurrences of the pattern in a string.
def __getstate__ | ( | self) |
Definition at line 494 of file pre.py.
References Compile.flags, RegexObject.flags, RegexObject.groupindex, and RegexObject.pattern.
def __setstate__ | ( | self, | |
statetuple | |||
) |
Definition at line 496 of file pre.py.
References RegexObject.code, Compile.flags, RegexObject.flags, RegexObject.groupindex, and RegexObject.pattern.
def findall | ( | self, | |
source | |||
) |
findall(source) -> list Return a list of all non-overlapping matches of the compiled pattern in 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.
Definition at line 452 of file pre.py.
References reconvert.append, RegexObject.match(), sre_parse.max, and log_faction_ships.tuple.
def match | ( | self, | |
string, | |||
pos = 0 , |
|||
endpos = None |
|||
) |
match(string[, pos][, endpos]) -> MatchObject or None If zero or more characters at the beginning of string match this regular expression, return a corresponding MatchObject instance. Return None if the string does not match the pattern; note that this is different from a zero-length match. Note: If you want to locate a match anywhere in string, use search() instead. The optional second parameter pos gives an index in the string where the search is to start; it defaults to 0. This is not completely equivalent to slicing the string; the '' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the search is to start. The optional parameter endpos limits how far the string will be searched; it will be as if the string is endpos characters long, so only the characters from pos to endpos will be searched for a match.
Definition at line 297 of file pre.py.
References RegexObject._num_regs.
def search | ( | self, | |
string, | |||
pos = 0 , |
|||
endpos = None |
|||
) |
search(string[, pos][, endpos]) -> MatchObject or None Scan through string looking for a location where this regular expression produces a match, and return a corresponding MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string. The optional pos and endpos parameters have the same meaning as for the match() method.
Definition at line 272 of file pre.py.
References RegexObject._num_regs.
def split | ( | self, | |
source, | |||
maxsplit = 0 |
|||
) |
split(source[, maxsplit=0]) -> list of strings Split string by the occurrences of the compiled pattern. If capturing parentheses are used in the pattern, then the text of all groups in the pattern are also returned as part of the resulting list. If maxsplit is nonzero, at most maxsplit splits occur, and the remainder of the string is returned as the final element of the list.
Definition at line 405 of file pre.py.
References reconvert.append, and RegexObject.match().
def sub | ( | self, | |
repl, | |||
string, | |||
count = 0 |
|||
) |
sub(repl, string[, count=0]) -> string Return the string obtained by replacing the leftmost non-overlapping occurrences of the compiled pattern in string by the replacement repl. If the pattern isn't found, string is returned unchanged. Identical to the sub() function, using the compiled pattern.
Definition at line 333 of file pre.py.
References RegexObject.subn().
def subn | ( | self, | |
repl, | |||
source, | |||
count = 0 |
|||
) |
subn(repl, string[, count=0]) -> tuple Perform the same operation as sub(), but return a tuple (new_string, number_of_subs_made).
Definition at line 346 of file pre.py.
References RegexObject._num_regs, reconvert.append, regsub.expand(), dospath.join(), and RegexObject.match().