using negative regex RÉ code example Example: regex negate ^(?!.*bar).*$ serial_number: [^((?!null).)*$]+