Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
URL validation
Message
From
26/01/2016 13:01:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01630233
Message ID:
01630236
Views:
92
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I have a textbox which will allow to enter a valid URL (https or http). Do you know what code should I use for validation of the user's input?
>
>Thanks in advance.
Function ValidUrl
Lparameters tcUrl
Local lcFilter As String, ;
   llReturn As Boolean, ;
   loRegex As Object
If Pcount() > 0 And Vartype(lcMail) = [C]
   Text To m.lcFilter Noshow Pretext 15
         ^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}
         (?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}
         (?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$
   Endtext
   m.loRegex = Createobject([VBScript.RegExp])
   m.loRegex.Pattern = m.lcFilter
   m.loRegex.IgnoreCase = .T.
   m.loRegex.Global = .F.
   m.llReturn = m.loRegex.Test(m.tcUrl)
   m.loRegex = .Null.
   Release m.loRegex
Endif
Return m.llReturn
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform