def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, flags=0, group=None):
    '\n        Perform a regex search on the given string, using a single or a list of\n        patterns returning the first matching group.\n        In case of failure return a default value or raise a WARNING or a\n        RegexNotFoundError, depending on fatal, specifying the field name.\n        '
    if isinstance(pattern, (str, compat_str, compiled_regex_type)):
        mobj = re.search(pattern, string, flags)
    else:
        for p in pattern:
            mobj = re.search(p, string, flags)
            if mobj:
                break
    if ((not self._downloader.params.get('no_color')) and (compat_os_name != 'nt') and sys.stderr.isatty()):
        _name = ('\x1b[0;34m%s\x1b[0m' % name)
    else:
        _name = name
    if mobj:
        if (group is None):
            return next((g for g in mobj.groups() if (g is not None)))
        else:
            return mobj.group(group)
    elif (default is not NO_DEFAULT):
        return default
    elif fatal:
        raise RegexNotFoundError(('Unable to extract %s' % _name))
    else:
        self._downloader.report_warning((('unable to extract %s' % _name) + bug_reports_message()))
        return None
Perform a regex search on the given string, using a single or a list of
patterns returning the first matching group.
In case of failure return a default value or raise a WARNING or a
RegexNotFoundError, depending on fatal, specifying the field name.
def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, flags=0, group=None):
    '\n        Perform a regex search on the given string, using a single or a list of\n        patterns returning the first matching group.\n        In case of failure return a default value or raise a WARNING or a\n        RegexNotFoundError, depending on fatal, specifying the field name.\n        '
    if isinstance(pattern, (str, compat_str, compiled_regex_type)):
        mobj = re.search(pattern, string, flags)
    else:
        for p in pattern:
            mobj = re.search(p, string, flags)
            if mobj:
                break
    if ((not self._downloader.params.get('no_color')) and (compat_os_name != 'nt') and sys.stderr.isatty()):
        _name = ('\x1b[0;34m%s\x1b[0m' % name)
    else:
        _name = name
    if mobj:
        if (group is None):
            return next((g for g in mobj.groups() if (g is not None)))
        else:
            return mobj.group(group)
    elif (default is not NO_DEFAULT):
        return default
    elif fatal:
        raise RegexNotFoundError(('Unable to extract %s' % _name))
    else:
        self._downloader.report_warning((('unable to extract %s' % _name) + bug_reports_message()))
        return None