You are here: Re: preg_match_all - help « All PHP « IT news, forums, messages
Re: preg_match_all - help

Posted by robert on 09/28/78 11:48

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:4dgmrnF1ae00iU1@individual.net...
|
| > Hmmz, I almost suspect it has something to do with how he posts.
| > I'm
| > assuming that the n's are supposed to be \n's... Probably it should
| > read:
| > '/\d+\)\s(.+)\s:\s(.+)/', which would be somewhat workable.
|
| The website I got it from had this problem :(
|
| > In that case this can be done faster without regexes:
| > $array = array();
| > $temp_array = explode("\n",$string);
| > foreach($temp_array as $value){
| > list($tkey, $tvalue) = explode(' : ',
| > substr($value,strpos($value,')')+1));
| > $array[trim($tkey)] = trim($tvalue);
| > }
|
|
| explode! That's brilliant, since now I can understand the code! This
| regexp thing drives me toallally nutz! I just don't get it. It's a
| programming language of its own...

explode won't completely work since the example shows numbers running right
into the next section of text.

regex IS a language. and just like any other language, you'll probably find
it indispensable once you learn it and know when/where to use it.

 

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

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