Reply to Re: REGEXP problem

Your name:

Reply:


Posted by frizzle on 10/13/06 07:04

Pedro Graca wrote:
> frizzle wrote:
> > Imagine the filename is index_en.html
> > My output needs to be an array with the following:
> > language => en (no underscore)
> > file => index (no "_en")
> > extension => html
> >
> > i created the following, but i don't know how to move on:
> > preg_split( '/^[a-z0-9]*(_(en|_ru))?\.[a-z0-9]{2,4}$/', $filename );
>
> preg_match() is your friend.
>
> if (preg_match('/^([a-z0-9]*)(?:_(en|ru))?\.([a-z0-9]{2,4})$/', $filename, $matches)) {
> $output['language'] = $matches[2];
> $output['file'] = $matches[1];
> $output['extension'] = $matches[3];
> }
>
>
> Reference: http://www.php.net/preg_match
>
> --
> File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Thanks all.

I'll use John's or Pedro's way.
I am a little bit familiar with regex, but it's stuffed away somewhere
down there, and i can't reach it. Yet!!
Anyway, thanks a lot for your help!!

Frizzle.

[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

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