Re: RegExp for preg_split()

From: Date: Sat, 29 Apr 2006 06:46:36 +0000
Subject: Re: RegExp for preg_split()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-235064@lists.php.net to get a copy of this message
Try this (don't pay attention to the name): /**
   * @param     string  $text
   * @return    array
   * @since     Sat Apr 29 01:35:37 CDT 2006
   * @author    rsalazar
*/ function parse_phrases( $text ) {
      $arr_pzas = array();
      if ( preg_match_all('/(?(?=["\'])(["\']).+?\\1|\w+)/X',
                          $text, $arr_pzas) ) {
          $arr_pzas = $arr_pzas[0];
      }
      return  $arr_pzas;
} // parse_phrases() Weber Sites LTD wrote:
Hi I'm looking for the RegExp that will split a search string into search keywords. while taking " " into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside " " to be in the same array cell. -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx


« previous php.general (#235064) next »