RegexModel.notContains constructor

RegexModel.notContains(
  1. String text(), {
  2. String? title,
})

Does not contain any word of text (3+ letters), ignoring case and accents: with the name "Ali-Can Yılmaz", "yilmaz123" fails. RegexModel.notContains(() => fullName.text).

Implementation

factory RegexModel.notContains(String Function() text, {String? title}) =>
    RegexModel(
      title: title ?? RegexLabels.current.notContains,
      test: (value) {
        final plain = _fold(value);
        return !_fold(text())
            .split(RegExp(r'[^\p{L}\p{N}]+', unicode: true))
            .any((word) => word.length >= 3 && plain.contains(word));
      },
    );