code: def pattern_match(data, values, level=None, regexp=False, has_nan=True):
      
      matches = np.array([False] * len(data))
      if not isinstance(values, collections.Iterable) or isstr(values):
          values = [values]
  
      # issue (#40) with string-to-nan comparison, replace nan by empty string
      _data = data.copy()
      if has_nan:
          _data.loc[[np.isnan(i) if not isstr(i) else False for i in _data]] = ''
  
      for s in values:
          if isstr(s):
              pattern = re.compile(_escape_regexp(s) + '$' if not regexp else s)
              subset = filter(pattern.match, _data)
              depth = True if level is None else find_depth(_data, s, level)
              matches |= (_data.isin(subset) & depth)
          else:
              matches |= data == s
      return matches
docs: matching of model/scenario names, variables, regions, and meta columns to
      pseudo-regex (if `regexp == False`) for filtering (str, int, bool)