RegexWars
Tier 4 · Enchantermatch

Cat Or Dog

Match strings containing "cat" or "dog" as a whole word.

The | operator is greedy about scope — it splits the whole pattern unless you fence it in with parentheses. A non-capturing group (?:...) does the fencing without creating a group you never use.

Your pattern0 chars · par 15
//
Flags
Start typing — tests run as you go.0 of 5 visible tests passing
Test cases
  • a catmust match
  • the dog barkedmust match
  • cataloguemust not match
  • dogmamust not match
  • a birdmust not match

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