matches static method

bool matches(
  1. String regex,
  2. String? input
)

返回输入是否匹配正则表达式。

Implementation

static bool matches(String regex, String? input) {
  if (input == null || input.isEmpty) {
    return false;
  }
  return RegExp(regex).hasMatch(input);
}