You can do it:
It matches any that is not one of these letters and returns the opposite:
if (!preg_match('/[^IOSHZXN]+/', $word)) {
echo "YES";
}
Also, if you want it to be case insensitive, you can use:
if (!preg_match('/[^IOSHZXN]+/i', $word)) {
echo "YES";
}
[^...] matches any that is not defined in parentheses.+ .i , .