# Prove ordered comparison rules

Preserve raw mismatch while applying exact, reviewed transformations. Demonstrate an incorrect order and recover.

Source: https://help.smartfact.ai/scannerbench/guides/ordered-rules

Audience: Supervisor

## Prove ordered comparison rules

1. **Start capture in the focused box**

   Start capture in the focused box.

   Start capture explicitly. Only this box collects keyboard input. These keystrokes are simulated; the course does not measure a physical scanner.

2. **Capture a prefixed value with outer spaces**

   Capture a prefixed value with outer spaces.

   This prepared value has outer spaces, a literal prefix and a suffix. Exact comparison retains every original character.

3. **Inspect what arrived**

   Inspect what arrived.

   Step 2 shows exactly what arrived, in quotes, with hidden characters shown as codes. Leaving step 1 pauses capture.

4. **Keep the raw comparison strict**

   Keep the raw comparison strict.

   The expected identifier has neither spaces nor the prefix or suffix. Comparison rules may be useful, but they must not replace the raw evidence.

5. **Open explicit comparison rules**

   Open explicit comparison rules.

   Rules change a copy of the received text, in order. The original scan and the exact comparison remain visible. They do not reprogram the scanner.

6. **Trim the outer ASCII spaces first**

   Trim the outer ASCII spaces first.

   The first explicit rule removes outer ASCII spaces. The prefix and suffix still remain, so the result with these rules is still different.

7. **Add a second comparison rule**

   Add a second comparison rule.

   Each added rule has its own position and arguments. Keep the order explicit so the transformation can be explained.

8. **Choose literal prefix removal**

   Choose literal prefix removal.

   This removes only an exact prefix, not an arbitrary regular expression. A prefix that is not at the beginning is not silently found elsewhere.

9. **Set the exact prefix argument**

   Set the exact prefix argument.

   Remove the literal ID colon prefix after outer spaces are trimmed. The suffix still remains and the exact difference is unchanged.

10. **Add the suffix rule**

   Add the suffix rule.

   A third ordered rule handles the remaining suffix. The transformation list belongs to comparison only.

11. **Choose literal suffix removal**

   Choose literal suffix removal.

   Choose suffix removal for the final exclamation mark. Literal arguments avoid broad transformations that could conceal useful differences.

12. **Set the exact suffix argument**

   Set the exact suffix argument.

   All three rules now match the expected identifier. The exact comparison still records the original value as different.

13. **Demonstrate why rule order matters**

   Demonstrate why rule order matters.

   Moving prefix removal before trimming means the raw leading space blocks the prefix match. The result with these rules must become different.

14. **Restore the checked transformation order**

   Restore the checked transformation order.

   Move trimming back to the first position. The match with these rules returns without altering the original capture.

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