rescapeGroup function
Escapes a group to ensure it remains a capturing group.
This prevents turning the group into a non-capturing group (?:...), a
lookahead (?=...), or a negative lookahead (?!...). Allowing these
patterns would break the assumption used to map parameter names to match
groups.
Implementation
String rescapeGroup(String group) =>
group.replaceFirstMapped(_groupRegExp, _escape);