例えば、 f5f6f7f8
みたいなのを アルファベット一文字 と 数字一文字
をセットとした List にしたい時。
こう書く。 See: https://api.dartlang.org/stable/2.5.0/dart-core/RegExp-class.html
void main() {
String str = "F5f6F7f8abcdefg";
print(_splitMoves(str)); // => [F5, f6, F7, f8]
}
List<String> _splitMoves(String moves) {
final exp = RegExp(r'([a-hA-H]{1}[1-8]{1})');
return exp?.allMatches(moves).map((match) => match.group(0)).toList();
}