match (/usr/lib/python3.6/re.py:172)
def 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."""
return _compile(pattern, flags).match(string)
def fullmatch(pattern, string, flags=0):
"""Try to apply the pattern to all of the string, returning
Local variable | Value |
---|---|
flags | 0 |
string | 'a' |
pattern | '[' |
_compile (/usr/lib/python3.6/re.py:289)
def _compile(pattern, flags):
# internal: compile pattern
try:
p, loc = _cache[type(pattern), pattern, flags]
if loc is None or loc == _locale.setlocale(_locale.LC_CTYPE):
return p
except KeyError:
Local variable | Value |
---|---|
flags | 0 |
pattern | '[' |
_compile (/usr/lib/python3.6/re.py:299)
def _compile(pattern, flags):
raise ValueError(
"cannot process flags argument with a compiled pattern")
return pattern
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled pattern")
p = sre_compile.compile(pattern, flags)
if not (flags & DEBUG):
Local variable | Value |
---|---|
flags | 0 |
pattern | '[' |
_compile (/usr/lib/python3.6/re.py:301)
def _compile(pattern, flags):
return pattern
if not sre_compile.isstring(pattern):
raise TypeError("first argument must be string or compiled pattern")
p = sre_compile.compile(pattern, flags)
if not (flags & DEBUG):
if len(_cache) >= _MAXCACHE:
_cache.clear()
Local variable | Value |
---|---|
flags | 0 |
pattern | '[' |
compile (/usr/lib/python3.6/sre_compile.py:560)
def compile(p, flags=0):
# internal: convert pattern list to internal format
if isstring(p):
pattern = p
p = sre_parse.parse(p, flags)
else:
Local variable | Value |
---|---|
flags | 0 |
p | '[' |
compile (/usr/lib/python3.6/sre_compile.py:562)
def compile(p, flags=0):
if isstring(p):
pattern = p
p = sre_parse.parse(p, flags)
else:
pattern = None
Local variable | Value |
---|---|
flags | 0 |
p | '[' |
pattern | '[' |
parse (/usr/lib/python3.6/sre_parse.py:847)
def parse(str, flags=0, pattern=None):
# parse 're' pattern into list of (opcode, argument) tuples
source = Tokenizer(str)
if pattern is None:
pattern = Pattern()
Local variable | Value |
---|---|
pattern | None |
flags | 0 |
str | '[' |
__init__ (/usr/lib/python3.6/sre_parse.py:231)
def __init__(self, string):
self.decoded_string = string
self.index = 0
self.next = None
self.__next()
def __next(self):
index = self.index
try:
Local variable | Value |
---|---|
string | '[' |
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |
parse (/usr/lib/python3.6/sre_parse.py:850)
def parse(str, flags=0, pattern=None):
source = Tokenizer(str)
if pattern is None:
pattern = Pattern()
pattern.flags = flags
pattern.str = str
Local variable | Value |
---|---|
pattern | None |
flags | 0 |
str | '[' |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
parse (/usr/lib/python3.6/sre_parse.py:855)
def parse(str, flags=0, pattern=None):
pattern.str = str
try:
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
except Verbose:
# the VERBOSE flag was switched on inside the pattern. to be
# on the safe side, we'll parse the whole thing again...
Local variable | Value |
---|---|
pattern | <sre_parse.Pattern object at 0x7fc74833b160> |
flags | 0 |
str | '[' |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
_parse_sub (/usr/lib/python3.6/sre_parse.py:413)
def _parse_sub(source, state, verbose, nested):
items = []
itemsappend = items.append
sourcematch = source.match
start = source.tell()
while True:
itemsappend(_parse(source, state, verbose, nested + 1,
not nested and not items))
Local variable | Value |
---|---|
nested | 0 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
items | [] |
itemsappend | <built-in method append of list object at 0x7fc74832ea88> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_parse_sub (/usr/lib/python3.6/sre_parse.py:416)
def _parse_sub(source, state, verbose, nested):
start = source.tell()
while True:
itemsappend(_parse(source, state, verbose, nested + 1,
not nested and not items))
if not sourcematch("|"):
break
Local variable | Value |
---|---|
nested | 0 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
items | [] |
itemsappend | <built-in method append of list object at 0x7fc74832ea88> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
start | 0 |
_parse (/usr/lib/python3.6/sre_parse.py:472)
def _parse(source, state, verbose, nested, first=False):
# parse a simple pattern
subpattern = SubPattern(state)
# precompute constants into local variables
subpatternappend = subpattern.append
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
_parse (/usr/lib/python3.6/sre_parse.py:488)
def _parse(source, state, verbose, nested, first=False):
break # end of pattern
if this in "|)":
break # end of subpattern
sourceget()
if verbose:
# skip whitespace and comments
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | '[' |
get (/usr/lib/python3.6/sre_parse.py:255)
return False
def get(self):
this = self.next
self.__next()
return this
def getwhile(self, n, charset):
result = ''
Local variable | Value |
---|---|
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |
this | '[' |
__next (/usr/lib/python3.6/sre_parse.py:235)
def __next(self):
index = self.index
try:
char = self.decoded_string[index]
except IndexError:
self.next = None
return
Local variable | Value |
---|---|
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |
index | 1 |
_parse (/usr/lib/python3.6/sre_parse.py:509)
def _parse(source, state, verbose, nested, first=False):
subpatternappend((LITERAL, _ord(this)))
elif this == "[":
here = source.tell() - 1
# character set
set = []
setappend = set.append
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | '[' |
_parse (/usr/lib/python3.6/sre_parse.py:515)
def _parse(source, state, verbose, nested, first=False):
setappend = set.append
## if sourcematch(":"):
## pass # handle character classes
if sourcematch("^"):
setappend((NEGATE, None))
# check remaining characters
start = set[:]
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | '[' |
here | 0 |
set | [] |
setappend | <built-in method append of list object at 0x7fc748875fc8> |
_parse (/usr/lib/python3.6/sre_parse.py:520)
def _parse(source, state, verbose, nested, first=False):
# check remaining characters
start = set[:]
while True:
this = sourceget()
if this is None:
raise source.error("unterminated character set",
source.tell() - here)
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | '[' |
here | 0 |
set | [] |
setappend | <built-in method append of list object at 0x7fc748875fc8> |
start | [] |
get (/usr/lib/python3.6/sre_parse.py:255)
return False
def get(self):
this = self.next
self.__next()
return this
def getwhile(self, n, charset):
result = ''
Local variable | Value |
---|---|
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |
this | None |
_parse (/usr/lib/python3.6/sre_parse.py:523)
def _parse(source, state, verbose, nested, first=False):
this = sourceget()
if this is None:
raise source.error("unterminated character set",
source.tell() - here)
if this == "]" and set != start:
break
elif this[0] == "\\":
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | None |
here | 0 |
set | [] |
setappend | <built-in method append of list object at 0x7fc748875fc8> |
start | [] |
_parse (/usr/lib/python3.6/sre_parse.py:523)
def _parse(source, state, verbose, nested, first=False):
this = sourceget()
if this is None:
raise source.error("unterminated character set",
source.tell() - here)
if this == "]" and set != start:
break
elif this[0] == "\\":
Local variable | Value |
---|---|
first | True |
nested | 1 |
verbose | 0 |
state | <sre_parse.Pattern object at 0x7fc74833b160> |
source | <sre_parse.Tokenizer object at 0x7fc74833b710> |
subpattern | [] |
subpatternappend | <bound method SubPattern.append of []> |
sourceget | <bound method Tokenizer.get of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
sourcematch | <bound method Tokenizer.match of <sre_parse.Tokenizer object at 0x7fc74833b710>> |
_len | <built-in function len> |
_ord | <built-in function ord> |
this | None |
here | 0 |
set | [] |
setappend | <built-in method append of list object at 0x7fc748875fc8> |
start | [] |
error (/usr/lib/python3.6/sre_parse.py:292)
self.__next()
def error(self, msg, offset=0):
return error(msg, self.string, self.tell() - offset)
def _class_escape(source, escape):
# handle escape code inside character class
Local variable | Value |
---|---|
offset | 1 |
msg | 'unterminated character set' |
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |
error (/usr/lib/python3.6/sre_parse.py:292)
self.__next()
def error(self, msg, offset=0):
return error(msg, self.string, self.tell() - offset)
def _class_escape(source, escape):
# handle escape code inside character class
Local variable | Value |
---|---|
offset | 1 |
msg | 'unterminated character set' |
self | <sre_parse.Tokenizer object at 0x7fc74833b710> |