RegexWars
Tier 5 · Conjurerextract

The Word Cat

Extract "cat" only where it stands as a whole word.

\b is a boundary between a word character and a non-word character. It is the anchor people forget, and the reason "cat" matches inside "concatenate".

Your pattern1 chars · par 8
//g
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases
  • cat→ ["cat"]
  • the cat sat→ ["cat"]
  • concatenate→ []
  • cat, cat and catalogue→ ["cat", "cat"]

+ 3 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.