I have the following code to match an escaped string:

```
match_str = r'''(["/']).*?(?<!\\)(\\\\)*\1'''
test_str = r'''"This is an \"escaped\" string" and this isn't.'''

mo = re.match(match_str, test_str)

if mo:
    print mo.group()

```

which works fine.

However, while I understand I need the groups in there to handle the repetition, etc., I'm not interested in using the groups after the match. I know I can just call `mo.group(0)` and get the whole thing, but for what I am doing it would be helpful if it could behave as if no groups were found in this type of case, i.e. that `mo.groups()` would return `(None)`.

Is there any way to do this?

EDIT: If it helps, I'm trying to do something like this:

```
ma = [myclass("regex1nogroups", [func1]),
      myclass("regex2twogroups", [func2, func3]),
      myclass("regex3fourgroups", [func4, func5, func6, func7]),
      myclass("regex4nogroups", [func8])]

for mc in ma:
    mo = re.match(mc.pattern, str_to_match)
    if mo:
        for n in range(len(mc.funclist)):
            result = mo.group(n+1 if mo.groups() else 0)
            mc.funclist[n](result)

```

using the length of the list of functions to determine how many groups the regex should produce. I could add an extra flag member to `myclass` to be true if I want to just assume there are no groups, but it would be nice to avoid this.