|
Posted by usenet+2004 on 10/07/06 16:11
Seb:
> I am trying to find the right regular expression which would only
> validate a URL with a given number of folders.
URLs don't have, or refer to, folders. The parts in between the
slashes in URL paths are called path segments, and they might or might
not correspond to a part of a filesystem.
> http://www.abc.com/folder/page.htm --> Valid (4 slahes)
>
> http://www.abc.com/folder/subfolder/ --> not valid (5 slashes)
>
> Basically, any URL not made of 4 slahes would be invalid.
Count the number of slashes in the string.
> http://www.abc.com/folder/subfolder --> would also be invalid
How would you distinguish that URL from your first example?
Now you see the problems arising from the confusion of URL paths and
filesystem paths.
--
Jock
Navigation:
[Reply to this message]
|