code: def grep(regex_list, recursive=True, dpath_list=None, include_patterns=None,
           exclude_dirs=[], greater_exclude_dirs=None, inverse=False,
           exclude_patterns=[], verbose=VERBOSE, fpath_list=None, reflags=0,
           cache=None):
      r
      from utool import util_regex
      from utool import util_list
      if include_patterns is None:
          include_patterns =  ['*']
      if greater_exclude_dirs is None:
          greater_exclude_dirs = []
      if isinstance(include_patterns, six.string_types):
          include_patterns = [include_patterns]
      if dpath_list is None:
          dpath_list = [os.getcwd()]
      if verbose:
          recursive_stat_str = ['flat', 'recursive'][recursive]
          print('[util_path] Greping (%s) %r for %r' % (recursive_stat_str,
                                                        dpath_list, regex_list))
          print('[util_path] regex_list = %s' % (regex_list))
      if isinstance(regex_list, six.string_types):
          regex_list = [regex_list]
      found_fpath_list = []
      found_lines_list = []
      found_lxs_list = []
      if fpath_list is None:
          fpath_generator = matching_fpaths(
              dpath_list=dpath_list, include_patterns=include_patterns,
              exclude_dirs=exclude_dirs,
              greater_exclude_dirs=greater_exclude_dirs,
              exclude_patterns=exclude_patterns, recursive=recursive)
      else:
          fpath_generator = fpath_list
      _exprs_flags = [util_regex.extend_regex2(expr, reflags)
                      for expr in regex_list]
      extended_regex_list = util_list.take_column(_exprs_flags, 0)
      reflags_list = util_list.take_column(_exprs_flags, 1)
      reflags = reflags_list[0]
      for fpath in fpath_generator:
          found_lines, found_lxs = grepfile(fpath, extended_regex_list,
                                            reflags_list, cache=cache)
          if inverse:
              if len(found_lines) == 0:
                  found_fpath_list.append(fpath)
                  found_lines_list.append([])
                  found_lxs_list.append([])
          elif len(found_lines) > 0:
              found_fpath_list.append(fpath)
              found_lines_list.append(found_lines)
              found_lxs_list.append(found_lxs)
      grep_result = (found_fpath_list, found_lines_list, found_lxs_list)
      if verbose:
          print('==========')
          print('==========')
          print('[util_path] found matches in %d files' %
                len(found_fpath_list))
          print(make_grep_resultstr(grep_result, extended_regex_list, reflags))
      return grep_result