Processes a regex match of a type's contents.
516960
def _process_type(self, name, modifiers, contents, module, match):
        """"""
        #First, we need to see if the types children are private.
        if self.RE_PRIV.search(contents):
            modifiers.append("private contents")

        #Next, we need to parse out all the members of the type and their docstrings
        members = self.vparser.parse(contents, None)
        
        #Now we can create the type code element and handle the member docstrings
        t = CustomType(name, modifiers, members, module)
        #parse out all the executables including the finalizer
        execs = self._process_execs(contents, module.name, t)

        #Set the regex start and end char indices
        t.start, t.end = module.absolute_charindex(match.string, match.start(),
                                                             match.end())

        #Update the parent for embedded members and executables
        for key in list(t.members.keys()):
            t.members[key].parent = t
        for key in list(t.executables.keys()):
            t.executables[key].parent = t

        #Extract the docstrings from the type body and associate them with their members
        memdocs = self.docparser.parse_docs(contents, t)
        if name in memdocs:
            docs = self.docparser.to_doc(memdocs[name][0], name)
            self.docparser.process_memberdocs(docs, t)

        return t
553587
function processToEqual( textContent ) {
      // using [\s\S] to match newline as well
      var matcher = /^(Expected )([\s\S]*?) ((?:not )?to (?:equal|be) )([\s\S]*?)\.$/;
      var matches = textContent.match( matcher );
      return matches && {
         prefix: matches[ 1 ],
         left: matches[ 2 ],
         relationText: matches[ 3 ],
         right: matches[ 4 ]
      };
   }
636788
def match(self, regexp, flags=None):
        """"""

        try:
            reg = _regexp_cache[(regexp, flags)]
        except KeyError:
            if flags:
                reg = re.compile(regexp, flags)
            else:
                reg = re.compile(regexp)
            _regexp_cache[(regexp, flags)] = reg

        return self.match_reg(reg)
449716
def iter_finds(regex_obj, s):
    """"""
    if isinstance(regex_obj, str):
        for m in re.finditer(regex_obj, s):
            yield m.group()
    else:
        for m in regex_obj.finditer(s):
            yield m.group()
290782
def parse(self, string, evaluate_result=True):
        '''
        '''
        m = self._match_re.match(string)
        if m is None:
            return None

        if evaluate_result:
            return self.evaluate_result(m)
        else:
            return Match(self, m)
1188596
def regxy(pattern, response, supress_regex, custom):
    """"""
    try:
        matches = re.findall(r'%s' % pattern, response)
        for match in matches:
            verb('Custom regex', match)
            custom.add(match)
    except:
        supress_regex = True
709382
def match_handle(loc, tokens):
    """"""
    if len(tokens) == 4:
        matches, match_type, item, stmts = tokens
        cond = None
    elif len(tokens) == 5:
        matches, match_type, item, cond, stmts = tokens
    else:
        raise CoconutInternalException("invalid match statement tokens", tokens)

    if match_type == "in":
        invert = False
    elif match_type == "not in":
        invert = True
    else:
        raise CoconutInternalException("invalid match type", match_type)

    matching = Matcher(loc, match_check_var)
    matching.match(matches, match_to_var)
    if cond:
        matching.add_guard(cond)
    return (
        match_to_var + " = " + item + "\n"
        + matching.build(stmts, invert=invert)
    )
23414
def type_regex(data, type)
      regex = [data[type]]
      if Phonelib.parse_special && data[Core::SHORT] && data[Core::SHORT][type]
        regex << data[Core::SHORT][type]
      end
      regex.join('|')
    end
1349130
def parse_content(self, text):
        """"""
        match = re.search(
            self.usage_re_str.format(self.usage_name),
            text,
            flags=(re.DOTALL
                   if self.case_sensitive
                   else (re.DOTALL | re.IGNORECASE)))

        if match is None:
            return

        dic = match.groupdict()
        logger.debug(dic)
        self.raw_content = dic['raw']
        if dic['sep'] in ('\n', '\r\n'):
            self.formal_content = dic['section']
            return

        reallen = len(dic['name'])
        replace = ''.ljust(reallen)
        drop_name = match.expand('%s\\g<sep>\\g<section>' % replace)
        self.formal_content = self.drop_started_empty_lines(drop_name).rstrip()
911165
public static boolean regexMatch(String input, String regex) {
        return Pattern.compile(regex).matcher(input).matches();
    }
246679
def _process_execs(self, contents, modulename, atype, mode="insert"):
        """"""
        #We only want to look at text after the contains statement
        match = self.RE_CONTAINS.search(contents)

        #It is possible for the type to not have any executables
        if match is not None:
            exectext = match.group("remainder")
            self._process_execs_contents(exectext, modulename, atype, mode)
1271809
def _match(self, regex):
        """"""
        cregex = re.compile(regex)
        for line in self.content.splitlines():
            match = cregex.match(line)
            if match:
                return match
        raise Exception('No "{0}" line in {1}.cpp'.format(
            regex_to_error_msg(regex),
            self.name
        ))
644220
def _filter_by_regex(self, regex, text, group=1):
        """"""
        match = re.search(
            regex,
            text,
            re.MULTILINE
        )

        return match.group(group).strip() if (
            match and match.groups()
        ) else text
1189932
def visit_regex(self, node, regex):
        """"""
        tilde, literal, flags, _ = regex
        flags = flags.text.upper()
        pattern = literal.literal  # Pull the string back out of the Literal
                                   # object.
        return Regex(pattern, ignore_case='I' in flags,
                              locale='L' in flags,
                              multiline='M' in flags,
                              dot_all='S' in flags,
                              unicode='U' in flags,
                              verbose='X' in flags,
                              ascii='A' in flags)
639999
def match_paren(self, tokens, item):
        """"""
        match, = tokens
        return self.match(match, item)
748438
def file_matches_regexps(filename, patterns):
    """"""
    return any(re.match(pat, filename) for pat in patterns)
278643
def _parse(self, text, i):
        """"""

        m = self.start_dict_re.match(text, i)
        if m:
            parsed = m.group(0)
            i += len(parsed)
            return self._parse_dict(text, i)

        m = self.start_list_re.match(text, i)
        if m:
            parsed = m.group(0)
            i += len(parsed)
            return self._parse_list(text, i)

        m = self.value_re.match(text, i)
        if m:
            parsed = m.group(0)
            i += len(parsed)
            if hasattr(self.current_type, "read"):
                reader = self.current_type()
                # Give the escaped value to `read` to be symetrical with
                # `plistValue` which handles the escaping itself.
                value = reader.read(m.group(1))
                return value, i

            value = self._trim_value(m.group(1))

            if self.current_type in (None, dict, OrderedDict):
                self.current_type = self._guess_current_type(parsed, value)

            if self.current_type == bool:
                value = bool(int(value))  # bool(u'0') returns True
                return value, i

            value = self.current_type(value)

            return value, i

        m = self.hex_re.match(text, i)
        if m:
            from glyphsLib.types import BinaryData

            parsed, value = m.group(0), m.group(1)
            decoded = BinaryData.fromHex(value)
            i += len(parsed)
            return decoded, i
        else:
            self._fail("Unexpected content", text, i)