In C# or javascript with regex, I could description a replace pattern as a string like this:
var replaced = Regex.Replace(text, pattern, "$1AA$3");
In dart, the replace part is a function
final newString = string.replaceAllMapped(RegExp(r'\b\w+\b'), (match) {
return '"${match.group(0)}"';
});
The problem is that, I want to write a util function, receive strReplacePattern as a string
Utils.replace(inputText, strPattern, strReplacePattern) { ... }
coder will simple input the replace part as a string pattern, dont neeed provide a match/replace function, how to implement like that in dart.
I want the replace part is a string pattern, not a callback function.
Thank you