# Check values that should and should not match

Use positive and negative cases to check a whole-code pattern, with fresh regex state for each value.

Source: https://help.smartfact.ai/patternbench/guides/expected-cases

Audience: Operator

Use positive and negative cases to check a whole-code pattern, with fresh regex state for each value. This is isolated practice with invented records. Nothing is uploaded or written into a live system.

## Check values that should and should not match

1. **Require a complete item code**

   Require a complete item code.

   Start and end anchors require the whole value. The multiline flag changes how these boundaries work, so leave it off for this check.

2. **Enter the code to check**

   Enter the code to check.

   Use BR-0201 as the source value. Separate expected cases will also check a value that should be refused.

3. **Add an expected matching case**

   Add an expected matching case.

   Each case runs with fresh regex state, so previous matches cannot change its result.

4. **Enter the complete code**

   Enter the complete code.

   This four-digit code should match the anchored pattern.

5. **Add an expected non-matching case**

   Add an expected non-matching case.

   A shorter code should not pass just because one valid code worked.

6. **Enter the short code**

   Enter the short code.

   BR-201 has only three digits. Keep it as a deliberate refusal case.

7. **Choose the expected refusal**

   Choose the expected refusal.

   This case should not contain a match. Set that expectation explicitly before running.

8. **Check both expected outcomes**

   Check both expected outcomes.

   Both cases must agree with their expectations. A match checks the pattern only, not whether an item exists in another system.

[Watch or practise this chapter](https://help.smartfact.ai/patternbench/demo?guide=expected-cases&chapter=expected-cases&audience=office)

Review the result and its limits before using it in another application.
