|
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]
|