You are here: Re: Help with regular expression « PHP Programming Language « IT news, forums, messages
Re: Help with regular expression

Posted by Jim Michaels on 02/15/06 23:45

"Jim Michaels" <jmichae3@nospam.yahoo.com> wrote in message
news:K_udnfGpBMlUPW7eRVn-sw@comcast.com...
>
> "Jim Michaels" <jmichae3@nospam.yahoo.com> wrote in message
> news:lOKdnVrN9K8GKnbeRVn-tg@comcast.com...
>> ([cC][oO][nN][cC][aA][tT]\s\(.*\)\s[aA][sS])?\s*(\w+\d+)|,([cC][oO][nN][cC][aA][tT]\s\(.*\)\s[aA][sS])?\s*(\w+\d+){1,}
>
> try this one. you might get better results. the ?;, may need to be changed
> to (, instead for things to work.
> (?:[cC][oO][nN][cC][aA][tT]\s\(?:.*\)\s[aA][sS])?\s*(\w+\d+)(?:,(?:[cC][oO][nN][cC][aA][tT]\s\(?:.*\)\s[aA][sS])?\s*(\w+\d+)){0,}


I forgot to mention - this must be used with the preg_match series of
functions, not ereg series.

>
>
>>
>> the problem with doing this is that you are going to get CONCAT AS (...)
>> as one of your array elements, so just delete it or detect and ignore it.
>> you can always detect it with preg_match("/^CONCAT/",$string);
>>
>>
>> "Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message
>> news:dqe547$90c$1$8300dec7@news.demon.co.uk...
>>>I am seeking help with a regular expression that will split a string into
>>>several parts with ',' (comma) as the separator, but NOT where the
>>>separator is enclosed in parentheses. For example, take the string
>>>"field1, CONCAT(field2,' ', field3) as field23, field4". I would like to
>>>be able to split this into the following:
>>> [0] field1
>>> [1] CONCAT(field2,' ', field3) as field23
>>> [2] field4
>>>
>>> Thanks in advance.
>>>
>>> --
>>> Tony Marston
>>> http://www.tonymarston.net
>>>
>>
>>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация