Reply to Re: simple question : regular expressions

Your name:

Reply:


Posted by Rik on 08/16/06 21:12

Don't toppost

wegenern@gmail.com wrote:
> Chung Leong wrote:
>> friglob wrote:
>>> Just found out...
>>>
>>> preg_split("%-%",$string_to_search,-1,PREG_SPLIT_NO_EMPTY);
>>>
>>> Thank you for your time.
>>
>> preg_split("/-+/", $string_to_search) is a somewhat more orthodox
>> solution.
> $string = "-1--3--8--22--550--1028-";
>
> if(ereg
>
("-([0-9]{1})--([0-9]{1})--([0-9]{1})--([0-9]{2})--([0-9]{3})--([0-9]{4})-",
> $string, $regs)){
> $array_set = array_splice($regs,1);
> print_r($regs);
> print_r($array_set); // <- This is the output requested.
> }

But a lot more undynamic & slower, I'd suggest using Chung's solution. It's
the fastest and the easiest altered.

Grtz,
--
Rik Wasmus

[Back to original 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

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