← All sheets
GL-A-020Sheet 020FOR CONSTRUCTIONA · ARTIFICIAL INTELLIGENCE

Regex catches what it can name. NER catches what it can't.

SECTION · REGEX vs NER · REDACTION ENGINE · DETECTION

Drawing sheet 020: Regex catches what it can name. NER catches what it can't.

General notes

  1. 01An email has a shape. A card number has a checksum. A pattern finds them in any language, deterministically, in microseconds.
  2. 02A person's name in running prose has no shape. That needs a model. Keep the two apart: patterns in the hot path, the model loaded only where prose demands it.

Schedule of methodsPick by data shape, not by fashion

DataMethodWhy
Email · phone · card · IBAN · keysValidated patternsDeterministic, ReDoS-safe, tiny
"Name: …" · "DOB: …" · JSON keysLabel-anchored patternsThe label gives the shape
Names, companies, places in proseNamed-entity modelNo shape to match

As posted

Regex catches what it can name. NER catches what it can't.

An email has a shape. A card number has a checksum. Patterns find them in any language, fast.

A name in prose has no shape. That needs a model. Models are heavy, so they load only where prose demands it.

Sheet 020.

Read with

  • Sheet 019 · (415) 555-0142 is invisible to most redaction.