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




_______________________________________________
Demexp-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/demexp-dev

Répondre à