If you are looking for specific words then regex is not necessary. You only need it when looking for patterns (like words containing "abc")
For exact string matches you should use the php exact string functions (of which there are a bunch, and any php documentation will have them).
To check if the field contains two words I would use explode and then check that the array contains two elements. Seeing if they are the same is just a matter of
if ($names[0] == $names[1])..... (though you might like to correct for case insensitivity)
|