RegexModel.notAllowed constructor

RegexModel.notAllowed(
  1. List<RegexChar> chars, {
  2. String allow = '',
  3. String? title,
})

None of the character groups in chars and none of the characters in allow: RegexModel.notAllowed([RegexChar.whitespace, RegexChar.dot]).

Implementation

factory RegexModel.notAllowed(
  List<RegexChar> chars, {
  String allow = '',
  String? title,
}) {
  final banned = RegexModel.allowOnly(chars, allow: allow);
  return RegexModel(
    title: title ?? RegexLabels.current.none(_words(chars, allow)),
    test: (value) =>
        !value.runes.any((r) => banned.matches(String.fromCharCode(r))),
  );
}