Example
Test a Regex for Ticket IDs Before Cleanup
A regex testing workflow for matching support ticket IDs while rejecting similar strings that should not be changed.
The situation
A team wants to find ticket IDs such as BUG-104 and DOC-221 in copied release notes, but it must not match words such as DEBUG-104 or incomplete IDs.
Sample text
Fixed BUG-104 and DOC-221.
Do not match DEBUG-104.
Ignore BUG- and DOC-abc.
Workflow
- Paste examples that should match and examples that should fail into the tester.
- Use a word boundary and explicit prefixes: \b(BUG|DOC)-\d+\b.
- Review matches and capture groups before applying the pattern elsewhere.
- Add more negative examples from real notes before using replacement.
- Retest in the target app if it uses a different regex dialect.
Expected matches
BUG-104
DOC-221
Review checks
- The pattern does not match DEBUG-104 because the prefix is constrained.
- Incomplete or nonnumeric IDs are rejected.
- The same pattern should be tested again in non-JavaScript environments.