diff --git a/kerchunk/combine.py b/kerchunk/combine.py index eb891de1..b30b8707 100644 --- a/kerchunk/combine.py +++ b/kerchunk/combine.py @@ -304,7 +304,11 @@ def _get_value(self, index, z, var, fn=None): elif isinstance(selector, list): o = selector[index] elif isinstance(selector, re.Pattern): - o = selector.search(fn).groups()[0] + regex_groups_o = selector.search(fn).groups() + if len(regex_groups_o) == 0: + o = selector.search(fn).group() + else: + o = regex_groups_o[0] elif not isinstance(selector, str): # constant, should be int or float o = selector