You are here: Re: simple question : regular expressions « PHP Programming Language « IT news, forums, messages
Re: simple question : regular expressions

Posted by wegenern@gmail.com on 08/16/06 17:28

$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.
}

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.

 

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

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