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