note 83512 added to function.preg-split

From: Date: Thu, 29 May 2008 10:56:46 +0000
Subject: note 83512 added to function.preg-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-139973@lists.php.net to get a copy of this message
For people who want to use the double quote to group words/fields, kind of like CSV does, you can use the following expression: <?php $keywords = preg_split( "/[\s,]*\\\"([^\\\"]+)\\\"[\s,]*|[\s,]+/", "textline with, commas and \"quoted text\" inserted", 0, PREG_SPLIT_DELIM_CAPTURE ); ?> Which will result in: Array ( [0] => textline [1] => with [2] => commas [3] => and [4] => quoted text [5] => inserted ) ---- Server IP: 64.71.164.2 Probable Submitter: 204.246.237.40 ---- Manual Page -- http://www.php.net/manual/en/function.preg-split.php Edit -- https://master.php.net/note/edit/83512 Del: integrated -- https://master.php.net/note/delete/83512/integrated Del: useless -- https://master.php.net/note/delete/83512/useless Del: bad code -- https://master.php.net/note/delete/83512/bad+code Del: spam -- https://master.php.net/note/delete/83512/spam Del: non-english -- https://master.php.net/note/delete/83512/non-english Del: in docs -- https://master.php.net/note/delete/83512/in+docs Del: other reasons-- https://master.php.net/note/delete/83512 Reject -- https://master.php.net/note/reject/83512 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139973) next »