Check if a string matches a given regex pattern.
bool matches(String string, String pattern) => new RegExp(pattern).hasMatch(string);