File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 8
8
* Add uppercase
9
9
* Add lowercase
10
10
* Add file extension
11
+ * Add notMatch
11
12
12
13
## 10.0.2
13
14
* Reland generated l10n files
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Available built-in validators include:
59
59
- ` FormBuilderValidators.integer() ` - requires the field's value to be an integer.
60
60
- ` FormBuilderValidators.ip() ` - requires the field's value to be a valid IP address.
61
61
- ` FormBuilderValidators.match() ` - requires the field's value to match the provided regex pattern.
62
+ - ` FormBuilderValidators.notMatch() ` - requires the field's value to not match the provided regex pattern.
62
63
- ` FormBuilderValidators.max() ` - requires the field's value to be less than or equal to the provided number.
63
64
- ` FormBuilderValidators.maxLength() ` - requires the length of the field's value to be less than or equal to the provided maximum size.
64
65
- ` FormBuilderValidators.maxWordsCount() ` - requires the word count of the field's value to be less than or equal to the provided maximum count.
Original file line number Diff line number Diff line change @@ -270,6 +270,16 @@ class FormBuilderValidators {
270
270
? errorText ?? FormBuilderLocalizations .current.matchErrorText
271
271
: null ;
272
272
273
+ /// [FormFieldValidator] that requires the field's value not to match the provided regex pattern.
274
+ static FormFieldValidator <String > notMatch (
275
+ String pattern, {
276
+ String ? errorText,
277
+ }) =>
278
+ (valueCandidate) => true == valueCandidate? .isNotEmpty &&
279
+ RegExp (pattern).hasMatch (valueCandidate! )
280
+ ? errorText ?? FormBuilderLocalizations .current.matchErrorText
281
+ : null ;
282
+
273
283
/// [FormFieldValidator] that requires the field's value to be a valid number.
274
284
static FormFieldValidator <String > numeric ({
275
285
String ? errorText,
You can’t perform that action at this time.
0 commit comments