Dart how to match and then replace a regexp
You have to use String.replaceAllMapped.
final string = '{name : aName, hobby : [fishing, playing_guitar]}';final newString = string.replaceAllMapped(RegExp(r'\b\w+\b'), (match) { return '"${match.group(0)}"';});print(newString);
This recipe is sponsored by Dart Cookbook.