Try to construct a nicely-formatted string for a list of matcher
    objects. Those may be compiled regular expressions or strings...
966957
def prettyMatcherList(things):
    """"""
    norm = []
    for x in makeSequence(things):
        if hasattr(x, 'pattern'):
            norm.append(x.pattern)
        else:
            norm.append(x)
    return "('%s')" % "', '".join(norm)
1173341
private boolean matchRegexp(String s, Pattern pattern) {
    final Matcher m = pattern.matcher(s);
    return m.matches();
  }
944223
function RegExpStringMapper(options) {
	if (!(this instanceof RegExpStringMapper)) {
		return new RegExpStringMapper(options);
	}
	options = options || {};
	this._formatters = [];
	this.addFormatter(createDefaultFormatter(options.serialize || getSerializeFn()));
	this.addFormatter(createMomentFormatter(options.moment));
	this._separator  = options.separator || '%';
	this._regex      = buildDefaultRegex(this._separator);
	this._magic      = '@RegExpStringMapper';
	this._separatorRegExp = RegExp(this._separator + this._separator, 'g');
	this._magicRegExp = RegExp(this._magic, 'g');
}
687546
def prep_regex(patterns):
    """"""

    flags = 0 if Config.options.case_sensitive else re.I

    return [re.compile(pattern, flags) for pattern in patterns]
807594
def concat(regex_list):
    
    output_list = []

    for regex in regex_list:
        output_list.append(consolidate(regex))
    return r''.join(output_list)
1099156
function regex (strings, ...args) {
  return String.raw(strings, ...args.map(_.escapeRegExp))
}
1172675
def make_regex(separator):
    
    return re.compile(r'(?:' + re.escape(separator) + r')?((?:[^' +
                      re.escape(separator) + r'\\]|\\.)+)')
737890
private void buildMatch(Object val)
    {
        if (val instanceof String[]) {
            _match = (String[]) val;
        }
        else {
            Iterator matchIterator = null;
            // this should return null, but we should handle it it does
            matchIterator = IteratorFactory.createIterator(val);
            if (matchIterator == null)
                matchIterator = IteratorFactory.EMPTY_ITERATOR;

            List matchList = new ArrayList();
            while (matchIterator.hasNext()) {
                Object o = matchIterator.next();
                if (o != null)
                    matchList.add(o.toString());
            }
            int size = matchList.size();

            _match = new String[size];
            for (int i = 0; i < size; i++) {
                _match[i] = matchList.get(i).toString();
            }
        }

        if (logger.isDebugEnabled()) {
            logger.debug("****** CheckboxGroup Matches ******");
            if (_match != null) {
                for (int i = 0; i < _match.length; i++) {
                    logger.debug(i + ": " + _match[i]);
                }
            }
        }
    }
1005954
def _validate_str_list(arg):
    '''
    
    '''
    if isinstance(arg, six.binary_type):
        ret = [salt.utils.stringutils.to_unicode(arg)]
    elif isinstance(arg, six.string_types):
        ret = [arg]
    elif isinstance(arg, Iterable) and not isinstance(arg, Mapping):
        ret = []
        for item in arg:
            if isinstance(item, six.string_types):
                ret.append(item)
            else:
                ret.append(six.text_type(item))
    else:
        ret = [six.text_type(arg)]
    return ret
316048
def __create_matcher(self, match_class, **keywds):
        """"""
        matcher_args = keywds.copy()
        del matcher_args['function']
        del matcher_args['recursive']
        if 'allow_empty' in matcher_args:
            del matcher_args['allow_empty']

        decl_matcher = decl_matcher = match_class(**matcher_args)
        if keywds['function']:
            self._logger.debug(
                'running query: %s and <user defined function>',
                str(decl_matcher))
            return lambda decl: decl_matcher(decl) and keywds['function'](decl)

        self._logger.debug('running query: %s', str(decl_matcher))
        return decl_matcher
926321
def _process_regex(cls, regex, rflags, state):
        """"""
        if isinstance(regex, Future):
            regex = regex.get()
        return re.compile(regex, rflags).match
618930
function methodMatch(part) {
    let maxMatch = null
    let maxMatchCount = 0

    // Go through each mapper and check if the name matches. Then, take the highest match to avoid matching
    // 'any', if 'any character' was given, and so on.
    Object.keys(mapper).forEach((key) => {
        const regex = new RegExp(`^(${key.replace(' ', ') (')})`, 'i')
        const matches = part.match(regex)

        const count = matches ? matches.length : 0

        if (count > maxMatchCount) {
            maxMatchCount = count
            maxMatch = key
        }
    })

    if (maxMatch) {
        // We've got a match. Create the desired object and populate it.
        const item = mapper[maxMatch]
        return new item['class'](maxMatch, item.method, buildQuery)
    }

    throw new SyntaxException(`Invalid method: ${part}`)
}
310466
function (selector) {
        var self = this, i, l, matches = [], item, match;

        // Compile string into selector expression
        if (typeof selector === "string") {
          selector = new Selector(selector);

          match = function (item) {
            return selector.match(item);
          };
        } else {
          // Use selector as matching function
          match = selector;
        }

        for (i = 0, l = self.length; i < l; i++) {
          item = self[i];

          if (match(item)) {
            matches.push(item);
          }
        }

        return new Collection(matches);
      }
873256
def validate_stringlist(s):
    """"""
    if isinstance(s, six.string_types):
        return [six.text_type(v.strip()) for v in s.split(',') if v.strip()]
    else:
        try:
            return list(map(validate_str, s))
        except TypeError as e:
            raise ValueError(e.message)
1209947
static List<String> parsePattern(String pattern) {
    List<String> parameters = new ArrayList<>(4);
    Matcher matcher = PARAM_REGEX.matcher(pattern);
    while (matcher.find()) {
      parameters.add(matcher.group(1));
    }
    return parameters;
  }
1128976
def compile_matchers(formatcode):
    
    matchers = {}
    for node_type in ["leaf", "single", "internal"]:
        if node_type == "leaf" or node_type == "single":
            container1 = NW_FORMAT[formatcode][0][0]
            container2 = NW_FORMAT[formatcode][1][0]
            converterFn1 = NW_FORMAT[formatcode][0][1]
            converterFn2 = NW_FORMAT[formatcode][1][1]
            flexible1 = NW_FORMAT[formatcode][0][2]
            flexible2 = NW_FORMAT[formatcode][1][2]
        else:
            container1 = NW_FORMAT[formatcode][2][0]
            container2 = NW_FORMAT[formatcode][3][0]
            converterFn1 = NW_FORMAT[formatcode][2][1]
            converterFn2 = NW_FORMAT[formatcode][3][1]
            flexible1 = NW_FORMAT[formatcode][2][2]
            flexible2 = NW_FORMAT[formatcode][3][2]

        if converterFn1 == str:
            FIRST_MATCH = "("+_NAME_RE+")"
        elif converterFn1 == float:
            FIRST_MATCH = "("+_FLOAT_RE+")"
        elif converterFn1 is None:
            FIRST_MATCH = '()'

        if converterFn2 == str:
            SECOND_MATCH = "(:"+_NAME_RE+")"
        elif converterFn2 == float:
            SECOND_MATCH = "(:"+_FLOAT_RE+")"
        elif converterFn2 is None:
            SECOND_MATCH = '()'

        if flexible1 and node_type != 'leaf':
            FIRST_MATCH += "?"
        if flexible2:
            SECOND_MATCH += "?"

        matcher_str= '^\s*%s\s*%s\s*(%s)?\s*$' % (FIRST_MATCH, SECOND_MATCH, _NHX_RE)
        compiled_matcher = re.compile(matcher_str)
        matchers[node_type] = [container1, container2, converterFn1, converterFn2, compiled_matcher]

    return matchers
405480
function toRegexpSource(val, keys, options) {
  if (Array.isArray(val)) {
    return arrayToRegexp(val, keys, options);
  }

  if (val instanceof RegExp) {
    return regexpToRegexp(val, keys, options);
  }

  return stringToRegexp(val, keys, options);
}