csv-schema icon indicating copy to clipboard operation
csv-schema copied to clipboard

A proper logical NOT operator

Open crizzis opened this issue 4 years ago • 1 comments

AFAIK Currently, the only way to express a negative rule is via the @matchIsFalse directive.

This means the entire column rule must be expressed either as a positive or a negative condition, and mixing positive and negative conditions (e.g. regex("[A-Z]+") and not(starts($another_column))) is not possible.

It would, therefore, be quite nice if a logical NOT operation was available that could invert the logic of arbitrary column validation expressions.

crizzis avatar Jun 30 '20 10:06 crizzis

By De Morgan's laws you could equivalently express that as

regex("[^A-Z]+") or starts($another_column) @matchIsFalse

though I agree that the representation with not is preferable (and this work around wouldn't apply in all cases, it only works for this example due to the availability of the negation operator in regex), so I'll label this as an enhancement request.

DavidUnderdown avatar Jul 01 '20 10:07 DavidUnderdown