in reply to search for 'cat' not followed by 'dog'

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.