replaceAllAndFormat method
Implementation
String replaceAllAndFormat(String text, RegExp pattern, String format) {
return text.replaceAllMapped(pattern, (match) {
return format.replaceAllMapped(firstGroupPattern, (placeholderMatch) {
final groupNumber = int.parse(placeholderMatch.group(1)!);
return match.group(groupNumber) ?? '';
});
});
}