Skip to content

String validators

These are the most abused validators — precision matters.

String — Equal / Not Equal

Used for

Exact text matching.

How it works

  • Direct string comparison

What it will find

  • Exact matches

What it will not find

  • Case variations
  • Extra whitespace
  • Synonyms

String — Contains / Not contains

Used for

Substring checks.

How it works

  • Searches for text occurrence

What it will find

  • Partial matches

What it will not find

  • Word boundaries
  • Regex patterns
  • Semantic meaning

String — Part of / Not part of

Used for

Reverse containment (“value is part of X”).

How it works

  • Checks if value is contained within a larger string

What it will find

  • Embedded values

What it will not find

  • Independent tokens
  • Pattern-based matches

String — Not empty / Empty

Used for

Explicit emptiness checks.

How it works

  • Tests for empty string

What it will find

  • ""

What it will not find

  • null
  • Whitespace-only values (unless trimmed earlier)

String — Matches

Used for

Pattern-based validation.

How it works

  • Applies regex to the string

What it will find

  • Complex structured formats
  • Naming conventions
  • Codes

What it will not find

  • Numeric logic
  • Semantic correctness
  • Values outside string context

Final rule

Validators do not make data correct. They only confirm whether data fits an expectation you already defined.

If you don’t know what question they are answering, the validator choice will always be wrong.