String processing utilities for extracting strings with various kinds
of delimiters
|
find_all(searchin,
substr)
Returns a list of locations where substr occurs in searchin locations
are not allowed to overlap |
source code
|
|
|
extract(source,
startdelim,
enddelim,
escape=None,
startinstring=False,
allowreentry=True)
Extracts a doublequote-delimited string from a string, allowing for
backslash-escaping returns tuple of (quoted string with quotes, still
in string at end). |
source code
|
|
|
extractwithoutquotes(source,
startdelim,
enddelim,
escape=None,
startinstring=False,
includeescapes=True,
allowreentry=True)
Extracts a doublequote-delimited string from a string, allowing for
backslash-escaping includeescapes can also be a function that takes
the whole escaped string and returns the replaced version. |
source code
|
|
|
escapequotes(source,
escapeescapes=0)
Returns the same string, with double quotes escaped with backslash |
source code
|
|
|
escapesinglequotes(source)
Returns the same string, with single quotes doubled |
source code
|
|
|
|
|
|
|
|
|
|
|
escapecontrols(source)
escape control characters in the given string |
source code
|
|
|
|
|
quotestr(source,
escapeescapes=0)
Returns a doublequote-delimited quoted string, escaping double quotes
with backslash. |
source code
|
|
|
singlequotestr(source)
Returns a doublequote-delimited quoted string, escaping single quotes
with themselves. |
source code
|
|
|
|
|
|
|
stripcomment(comment,
startstring=' <!-- ' ,
endstring=' --> ' ) |
source code
|
|
|
unstripcomment(comment,
startstring=' <!-- ' ,
endstring=' -->\n ' ) |
source code
|
|