note 53749 deleted from function.preg-replace by didou

From: Date: Sun, 23 Apr 2006 22:49:44 +0000
Subject: note 53749 deleted from function.preg-replace by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109225@lists.php.net to get a copy of this message
Note Submitter: congaz at yahoo dot dk ---- I've just discovered something very annoying the hard way: (an hour of insanity-checking my code) When using preg_replace (or anyother preg_...function I assume), with numerical quantifiers such as {n,m}, it is imperative not(!) to have whitespace following the comma. Thus: NOT working example: $string = preg_replace('#([search parameters]{2, 2})#', 'replacement', $string); Working example: $string = preg_replace('#([search parameters]{2,2})#', 'replacement', $string); This may be common knowledge for some, but it illuded me - especially as I find it good readabillity practice, always to add a whitespace after a comma. Regards, Michael (DK).

« previous php.notes (#109225) next »