Extract order references and test a near miss

Enter the pattern below without surrounding slash delimiters, enable the g flag, and use the sample text. Expect two complete matches: ORD-1042 and ORD-0099. The five-digit reference should not match.

Remove the final word boundary and repeat the test. The pattern can now match the first four digits of ORD-12345. This is why a useful test set includes near misses as well as examples you expect to pass.

Pattern: \bORD-\d{4}\b
Flags: g
Text: ORD-1042 ORD-0099 ORD-12345

Where this workflow can go wrong

The tester uses JavaScript regular expressions. A pattern accepted here may behave differently in PCRE, Python, or a database engine. Avoid nested unbounded quantifiers on large or untrusted input: a synchronous expression can block the browser tab. Test small samples before processing a log file.

Check your result

Add lowercase ord-1042, an empty string, and a reference attached to other letters. Decide deliberately whether each should match, then change flags or boundaries accordingly. Matching a format is separate from confirming that an order exists.

Read the full guide · Technical reference

About this tool

Tests a JavaScript regular expression against supplied text and flags.

How to use

Try a small positive example and a near miss; compare complete matches and positions.

Tips & Notes

Expressions can behave differently in other engines. Avoid expensive nested patterns on large input; matching syntax does not prove that the underlying record exists.