8. Picture/Format Check

You may see this validation technique referred to as either a picture or a format check, they are the same thing so no need to worry that you need to learn two different definitions.

Some types of data will always consist of the same pattern.

Example 1

Think about a postcode. The majority of postcodes look something like this:

CV36 7TP

WR14 5WB

Replace either of those examples with L for any letter which appears and N for any number that appears and you will end up with:

LLNN NLL

This means that you can set up a picture/format check for something like a postcode field to ensure that a letter isn't entered where a number should be or a number in place of a letter.

n.b. a few postcodes break this rule e.g. B9 7NT. You can still set up a picture/format check to include this variation.

Example 2

A National Insurance number must be in the form of XX 99 99 99 X.  The first two and the last characters must be letters.  The other six characters are numbers. Any format entered differently to this will be rejected.