You are here: Re: split with regex « All PHP « IT news, forums, messages
Re: split with regex

Posted by Aerik on 05/04/07 18:53

You're using split wrong - it's for "splitting it on boundaries formed
by the case-sensitive regular expression" - the regex is the dividing
boundary, not the text you're matching.

Try this:

$filename = 'C17AA001.000';
preg_match("/([0-9a-zA-Z]{5})([0-9]{3})(\.[0-9]{3})/",$filename,
$matches);
//print_r($matches);
list($x, $a, $b, $c,) = $matches;//discard x
echo $a;
echo $b;
echo $c;

Aerik (a tweener myself)
http://www.wikidweb.com - the Wiki Directory of the Web

 

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

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