|
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]
|