Sounds like you're looking for negative lookahead: /cat(?!\s*dog)/ (link goes to interactive regex tester, modern browser required)
See also Re: How to ask better questions using Test::More and sample data.
In reply to Re: search for 'cat' not followed by 'dog'
by haukex
in thread search for 'cat' not followed by 'dog'
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |