You are here: Re: Help with regex to validate URL format « PHP Programming Language « IT news, forums, messages
Re: Help with regex to validate URL format

Posted by Seb on 10/07/06 17:38

Thanks.

I guess all my actual files would be file extensions (.htm etc) whereas
a path segment wouldn't.

The question was around which regular expression I can use to access
something with 4 slashes, and which does not finish with ".***" or
".****".

Thanks,
Seb

usenet+2004@john.dunlop.name wrote:
> 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]


Удаленная работа для программистов  •  Как заработать на 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

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