Reply to Re: strpos - and multiple needles?

Your name:

Reply:


Posted by Tim Roberts on 12/29/07 07:12

My Pet Programmer <anthony@mypetprogrammer.com> wrote:
>
>preg_match('/^([a-zA-Z]\:)(\\[^\\/:*?<>"|]*(?<![
>]))*(\.[a-zA-Z]{2,6})$/', $filename);
>
>That one should only match valid filenames.

There are two things here I don't understand. First, I don't understand
what you are trying to do with (?<![ ]). (I assume there was a space in
there that caused the line to wrap.) As I read it, that says "fail if the
last character of the previous match was a space", but since the pattern
before it matches all the characters in the pattern after it, I don't see
how it could ever take effect.

Second, I don't get what you are trying to do with (\.[a-zA-Z]{2,6}). Is
that supposed to be matching an extension? That fails for "test.c".

Also, that requires a drive letter. Was that your intent?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

[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

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