Url validation test

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
hansmarc
Posts: 40
Joined: Thu Jun 23, 2016 5:38 am
Location: Belgium

Url validation test

Post by hansmarc »

Hi,

can someone point me to a previous discussion or give me a hint how i can test if a URL is valid.
I read some articles that use regular expressions.

one of the examples that i found but it does not work :

cRegex := "((http|https)://)(www.)?" ;
+ "[a-zA-Z0-9@:%._\\+~#?&//=]" ;
+ "{2,256}\\.[a-z]" ;
+ "{2,6}\\b([-a-zA-Z0-9@:%" ;
+ "._\\+~#?&//=]*)"

if hb_RegexLike( cRegex, cTargetUrl, .F. )
msgstop("Valid Url")
else
msgstop("Invalid Url")
endif

Thanks
Hans
Post Reply