Matches the specified *regex* from the current character of the *scanner*
    and returns the result. The Scanners column and line numbers are updated
    respectively.

    # Arguments
    regex (str, Pattern): The regex to match.
    flags (int): The flags to use when compiling the pattern.

def match(self, regex, flags=0):
    """
    Matches the specified *regex* from the current character of the *scanner*
    and returns the result. The Scanners column and line numbers are updated
    respectively.

    # Arguments
    regex (str, Pattern): The regex to match.
    flags (int): The flags to use when compiling the pattern.
    """

    if isinstance(regex, str):
      regex = re.compile(regex, flags)
    match = regex.match(self.text, self.index)
    if not match:
      return None
    start, end = match.start(), match.end()
    lines = self.text.count('\n', start, end)
    self.index = end
    if lines:
      self.colno = end - self.text.rfind('\n', start, end) - 1
      self.lineno += lines
    else:
      self.colno += end - start
    return match