hasMatch static method

bool hasMatch(
  1. String? value,
  2. String pattern
)

Checks if a given value matches a pattern using a regular expression.

Returns true if the value matches the pattern, false otherwise.

Implementation

static bool hasMatch(String? value, String pattern) => switch (value) {
  null => false,
  _ => RegExp(pattern).hasMatch(value)
};