note 45707 deleted from reference.pcre.pattern.modifiers by nlopess

From: Date: Sat, 18 Sep 2004 11:30:02 +0000
Subject: note 45707 deleted from reference.pcre.pattern.modifiers by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76940@lists.php.net to get a copy of this message
Note Submitter: nospam at snecx dot com ---- Please note that when it means all whitespace characters are ignored when x (PCRE_EXTENDED) modifier is set, the use of \t, \r, and \n (and some others as well) will not work outside character class and need to be escaped as \\t, \\r, or \\n. Hope this might help to clear up some confusions. Example: <?php // returns 1 (matches) preg_match("/A B C/x", "ABC"); // also returns 1 (matches) preg_match("/A \\n B \\n C/x", "ABC"); // returns 0 (does not match because in order for \\n to be captured you must escape it) preg_match("/A \\n B \\n C/x", "A\\nB\\nC"); // returns 1 (matches) preg_match("/A \\\\n B \\\\n C/x", "A\\nB\\nC"); ?>

« previous php.notes (#76940) next »