You are here: Re: who is good at regular expressions? « PHP Programming Language « IT news, forums, messages
Re: who is good at regular expressions?

Posted by brendan on 09/07/05 15:35

"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote in
message news:431edcae$0$11079$e4fe514c@news.xs4all.nl...

> > We want to allow the user to specify database columns by using
> >
> > [column name][colon][search text]
> >
> > i.e.
> > "author:Jane Smith institution:university of Cambridge year:1976"
> Who needs regexp? :P
>
> Try something like this:
>
> <?
> // [column name][colon][search text]
>
> $test = "author:Jane Smith institution:university of Cambridge year:1976";
> $result = array();
>
> $parts = explode(":",$test);
> for($i=0;$i<count($parts);$i+=2){
> $result[$parts[$i]] = $parts[$i+1];
>
> Regards,
> Erwin Moller
>
> PS: Does your reward also include the ticket to Cambridge from Holland?
;-)

Hi Erwin,
Exploding on the colon will result in the column name ending up in the
previous array set
ie
arrayname["author"]= "Jane Smith institution";
arrayname["university of Cambridge year"1976";
....
which is unfortunately not what I am looking for ... I need it to split at
the begining of any word ending in a colon, not at the colon point.
Unfortunately the offer doesn't include the ticket. However, I'm sure I
could organise delivery next time I am up your way ;)
b.

 

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

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