Re: RegExp for preg_split()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux