grouping in sed with OR operator in bash in one line

Toby <[email protected]> Tue, 20 Jul 2010 10:50:06 -0700 (PDT)
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <caa6a54d-8488-499c-8057-f24e930f36e1@g35g2000yqa.googlegroups.com>
Hi,

I would like to replace a a set of words by another word via sed. My
first try was:

  echo "a cat or a dog" | sed 's/\(cat\)\|\(dog\)/PET/g'

I also tried some variations of this. But all failed.

For any help I would be very happy.

Cheers,
Toby

P.S. some variations of the search pattern
\(cat|dog\)
\(\(cat\)\|\(dog\)\)