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/16 11:48

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:4dfvjuF19pargU1@individual.net...
|I don't know where to look for the syntax of that command.
|
|
| Here's the string I have:
| 0) Kung Fu : 1000n1) jack : 150n2) jim : 10n3) jonny : 0n
|
| It should split up in:
| array('Kung Fu' =>1000, 'jack'=>150, 'jim'=>10, 'jonny'=>0);
|
| That's what I have found somewhere:
| preg_match_all('/d+)s(.+)s:s(.+)/', $content, $tokens);
|
| But it gives:
| Warning: preg_match_all() [function.preg-match-all]: Compilation
| failed: unmatched parentheses at offset 2

'\(\s*?([^:]*?)\s*?:\s*?(\d+)'

something like that should get it...you didn't escape the first parenth, nor
did you escape *any* of the space characters (\s)...nor would your
expression have returned anything close to what your description of results
shows.

 

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

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