|
Posted by Gernot Frisch on 09/28/64 11:48
> 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...
Navigation:
[Reply to this message]
|