note 69568 deleted from function.preg-match by bjori

From: Date: Mon, 11 Sep 2006 09:54:04 +0000
Subject: note 69568 deleted from function.preg-match by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117008@lists.php.net to get a copy of this message
Note Submitter: turdus at gmail dot com ---- Be aware, the "any character" (.) does not apply to LF and CR characters! I though they are good as any as any other, but they don't. So this will not match: $str="<B>something\nsomething else</B>"; if(preg_match("/<([^>]+)>(.*)<\/\\1>/",$str)){ echo("match!"); } else { echo("not match!!!"); } You have to replace them (eg str_replace("\n","@NL@",$str)) to make preg_match work as expected.

« previous php.notes (#117008) next »