0

Consider a phrase: The quick brown fox jumps over the lazy dog

The quick brown fox jumps over the lazy dog.

I want to write a regex of the form:

if phrase doesn't contain `cat` then
  does phrase contain dog?
else
  no match
end

I think it should be

(?(cat)|dog)

But this doesn't work.

What am I doing wrong?

cjm2671
  • 18,348
  • 31
  • 102
  • 161

0 Answers0