note 69568 added to function.preg-match

From: Date: Mon, 11 Sep 2006 09:23:23 +0000
Subject: note 69568 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-117004@lists.php.net to get a copy of this message
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. ---- Server IP: 195.70.37.52 Probable Submitter: 213.178.118.30 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/69568 Del: integrated -- https://master.php.net/note/delete/69568/integrated Del: useless -- https://master.php.net/note/delete/69568/useless Del: bad code -- https://master.php.net/note/delete/69568/bad+code Del: spam -- https://master.php.net/note/delete/69568/spam Del: non-english -- https://master.php.net/note/delete/69568/non-english Del: in docs -- https://master.php.net/note/delete/69568/in+docs Del: other reasons-- https://master.php.net/note/delete/69568 Reject -- https://master.php.net/note/reject/69568 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117004) next »