Posted By

svenito on 09/29/09


Tagged

search String split


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Split string by commas and spaces but preserve quoted strings


 / Published in: Regular Expression
 

will split the string "I am" search words

into [0] => I am [1] => searching [2] => words

  1. $split_tags = preg_split( "/[\s,]*\\\"([^\\\"]+)\\\"[\s,]*|[\s,]+/", $search_term, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY );

Report this snippet  

You need to login to post a comment.