Checks whether the string matches a given regex pattern.
pattern
Example:
print('hello123'.hasMatch(r'\d+')); // true
bool hasMatch(String pattern) => RegExp(pattern).hasMatch(this);