Help with a macro that returns a regular expression

I have written a macro that returns a regular expression (already mentioned there), and for a regular expression to be usable in all suitable places, the macro has to return Regex<Substring>, Regex<(Substring,Substring)>, or Regex<(Substring,Substring,Substring)> etc., so I implemented the possible calls

#regexWithCharacterClassesAnd1Group(...)
#regexWithCharacterClassesAnd1Group(...)
#regexWithCharacterClassesAnd2Groups(...)
#regexWithCharacterClassesAnd3Groups(...)

etc. of the macro, until 7 groups. (The user provides a textual regular expression where some parts will be replaced by a list of characters and ranges, so the user should know about the number of groups and at least there is a compiler error if the wrong macro call being used.) I do not see any common type that could be returned (e.g. a RegexComponent won't be usable in all places), and also no other method to come a better solution, ideally one would like to just call the same

#regexWithCharacterClasses(...)

Has anyone an idea?