note 26403 deleted from pcre.pattern.syntax by sniper

From: Date: Tue, 30 Sep 2003 12:20:46 +0000
Subject: note 26403 deleted from pcre.pattern.syntax by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57421@lists.php.net to get a copy of this message
Note Submitter: apass AT passmoore DOT com ---- Having problems with "?" wiping out (invalidating) your match? This proved invalid for me... "Because it [?] has two uses, it can sometimes appear doubled, as in \d??\d which matches one digit by preference, but can match two if that is the only way the rest of the pattern matches." Here's how: "(?:.*fax\s(.*)•)" would match this "fax 212-966-5349 •", but this wouldn't match it: "(?:.*fax\s(.*)•)?". The "?" was supposed to let either 0 or 1 matches get caught, but only this would let that happen: "(?:.*fax\s(.*)•)??". Go figure. Sometimes "??" is better than "?"!

« previous php.notes (#57421) next »