验证字符串是否匹配正则表达式 Validate string against regex pattern
static bool matchesPattern(String str, String pattern) { return RegExp(pattern).hasMatch(str); }