Week 7

Response Validation

A pattern for the shape of an email address.

You type

An email address.

The tool
The shape of an address Some text An @ and a dot Valid or invalid
What comes out

Valid or invalid.

The question, more slowly

The question is: is this string an email address of the shape the spec allows? Valid or invalid. The spec is stricter than 'it has an @ and a dot'. It says which characters may appear, and where the dot has to sit.

Full match again: the whole string is the address, with nothing else around it. A space in the middle fails. Two @ signs fail.

People allow any character before the @. Read the allowed set in the spec and test one address that uses a character from outside that set.

Before you code

The spec is stricter than 'has an @'. Read the allowed characters before you write the pattern.