Welcome to RegexAdvice Sign in | Join | Help

Pranav Ainavolu

VSTO, COM and Outlook
Check for valid URL using Regular Expressions

Here is the code to check whether the given string is a valid URL or not using Regular Expresssions.

Public Function IsValidUrl(ByVal Url As String) As Boolean
       Dim strRegex As String = "^(https?://)" _
                                 & "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" _
                                 & "(([0-9]{1,3}\.){3}[0-9]{1,3}" _
                                 & "|" _
                                 & "([0-9a-z_!~*'()-]+\.)*" _
                                 & "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." _
                                 & "[a-z]{2,6})" _
                                 & "(:[0-9]{1,4})?" _
                                 & "((/?)|" _
                                 & "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"

        Dim re As RegularExpressions.Regex = New RegularExpressions.Regex(strRegex)
        MessageBox.Show("IP: " & Net.IPAddress.TryParse(Url, Nothing))
        If re.IsMatch(Url) Then
            Return True
        Else
            Return False
        End If
End Function

Hope this helps!

What are Collaboration Data Objects (CDO)?

Collaboration Data Objects or CDO, is a component that enables messaging between applications. It's something like the MFC we have in VC++ that enables us to prefer a simpler interface compared to the WIN32 API which, as an interface, still requires lots of escalation work by developers (yet very robust!).

CDO is primarily built to simply the creations of messaging applications and we should keep in mind that CDO is NOT a new messaging model but is BUILT ON the MAPI architecture. It is just an extended interface that collaborates with MAPI and simplifies the programming task at hand for creation of messaging applications. CDO replaced Microsoft's earlier Active Messaging. CDO 1.2 enables us to play around with Data, send, receive emails and a host of other functions like rendering in exchange functionalities into HTML and do loads of other stuff.

If you've got some firsthand experiences, a couple of tips will be great and will defiantly further my knowledge base in this area and hopefully get me a more refined understanding. Some pointers on MAPI will be pretty cool.