检查字符串中的新行

Can anyone tell me why this isn't working? It always returns false.

$str = "huuhhu

moo.com
www";

if (preg_match('/(\
|\\
|\)/', $str) === true) {
    echo "True";
} else {
    echo "False";
}

preg_match doesn't return true. It returns the number of matches. You need to do this:

$str = "huuhhu

moo.com
www";

if (preg_match('/(\
|\\
|\)/', $str)) {
    echo "True";
} else {
    echo "False";
}

Also, you could probably simplify your expression to this:

'/
|
?/'

preg_match() returns the number of times pattern matches and FALSE if an error occurred. It never returns true.