Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

naming convention
how can i validate a field for a valid URL?? is ther any naming
conventions for it?

Report this thread to moderator Post Follow-up to this message
Old Post
angie
04-03-08 12:37 AM


Re: naming convention
angie a écrit :
> how can i validate a field for a valid URL?? is ther any naming
> conventions for it?

Same as for your question about identifying the IP address.
You can check again a regex (there are many already done out there).
A good starting point is:
http://regexlib.com/DisplayPatterns...=1&categoryId=2

Michael


Report this thread to moderator Post Follow-up to this message
Old Post
Michael DOUBEZ
04-03-08 12:37 AM


Re: naming convention
On Apr 2, 2:46 pm, Michael DOUBEZ <michael.dou...@free.fr> wrote:
> angie a =E9crit :
 

> Same as for your question about identifying the IP address.
> You can check again a regex (there are many already done out there).
> A good starting point is:http://regexlib.com/DisplayPatterns.aspx?cattabin=[/color
]
dex=3D1&categoryId=3D2

Except that a regular expression which accepts all syntactically
valid URL's, and rejects all syntactically invalid ones, is far
from trivial; the one you cite, for example, will reject a lot
of legal URL's ("news://comp.lang.c%2B%2B", for example:-), and
accept a few illegal ones (e.g. "www.").  I pretty sure it can
be done with a regular expression, but it will take a bit of
work to get it right.  (Note too that different types of URL's
may have slightly different syntax.  If the protocol is
"mailto", for example, a '@' is required at one point, whereas
if it is "http", one may not appear unless quoted somehow (e.g.
"%40").

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34

Report this thread to moderator Post Follow-up to this message
Old Post
James Kanze
04-03-08 11:17 AM


Re: naming convention
James Kanze a écrit :
> On Apr 2, 2:46 pm, Michael DOUBEZ <michael.dou...@free.fr> wrote: 
> 
> 
>
> Except that a regular expression which accepts all syntactically
> valid URL's, and rejects all syntactically invalid ones, is far
> from trivial; the one you cite, for example, will reject a lot
> of legal URL's ("news://comp.lang.c%2B%2B", for example:-), and
> accept a few illegal ones (e.g. "www.").  I pretty sure it can
> be done with a regular expression, but it will take a bit of
> work to get it right.

Yes. That is why I provided the link to a regex library instead of
giving a specific regex. The site indicate what URI are accepted or
rejected depending on the regex used.

>  (Note too that different types of URL's
> may have slightly different syntax.  If the protocol is
> "mailto", for example, a '@' is required at one point, whereas
> if it is "http", one may not appear unless quoted somehow (e.g.
> "%40").

Or ftp that uses @ to separate the username/password from the actual
address:
ftp://john_dow:password@ftp.secure.com:245/path/to/data

Perhaps Boost.Spirit would be more fitting for capturing more complex
URI. At least It would be more manageable.

Michael

Report this thread to moderator Post Follow-up to this message
Old Post
Michael DOUBEZ
04-03-08 11:17 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C++ archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:57 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.