note 36961 deleted from function.preg-split by colder

From: Date: Mon, 18 Jun 2007 19:39:44 +0000
Subject: note 36961 deleted from function.preg-split by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127664@lists.php.net to get a copy of this message
Note Submitter: galium at sandnarrows dot com ---- Struggled with this today and just thought I would toss out a note in case anyone else has a problem. When using PREG_SPLIT_DELIM_CAPTURE the note about parenthesized expression is rather important. If you do: preg_split('( and | or | not )',"blah and blarg or ick",-1,PREG_SPLIT_DELIM_CAPTURE); It returns: Array ( [0] => blah [1] => blarg [2] => ick ) Notice the delimiters are missing. If you put extra () in: preg_split('(( and )|( or )|( not ))',"blah and blarg or ick",-1,PREG_SPLIT_DELIM_CAPTURE); It returns: Array ( [0] => blah [1] => and [2] => blarg [3] => [4] => or [5] => ick )

« previous php.notes (#127664) next »