demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Demexp-dev] What to check in an HTTP URL?


From: Felix HENRY
Subject: Re: [Demexp-dev] What to check in an HTTP URL?
Date: Mon, 19 Sep 2005 23:38:44 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050817)

David MENTRE a écrit :

>Hello,
>
>For the clients of demexp, I need to check that an HTTP URL given by the
>user is reasonably correct: not overly long, correct set of characters,
>etc.
>
>Any idea of a regexp and/or things to check? Any pointer?
>
>Yours,
>d.
>  
>

I'm not sur it's the most efficient solution, but you could use
urlview . This utility browses a text file and looks for URLs,
and returns them. This has the disadvantage of adding another
dependency and maybe it's not worth it.

You will note that the urlview man page contains the regular
expression for a URL. Here it is:

(((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0
-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]

It's rather ugly.

      Félix






reply via email to

[Prev in Thread] Current Thread [Next in Thread]