Hi All,
can anyone give me the regx expression to be used to search for ip address in microsoft visual studio versions. If I open text files using Visual studio and ctrl+Shift+F, search al open documents, then give the regex, it should list all the ipaddress contained lines at the bottom.The ip address I consider is any four numbers seperated by three dots. Eachnumber contains maximum three digits and minimum 1 digit.

it can be 0.0.0.0 or 127.0.0.1 etc.
Please give me the regex.

see if this help :

Public Function IsValidIP(ByVal addr As String) As Boolean
    'create our match pattern
    Dim pattern As String = "^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\." & _
    "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$"
    'create our Regular Expression object
    Dim check As New Text.RegularExpressions.Regex(pattern)
    'boolean variable to hold the status
    Dim valid As Boolean = False
    'check to make sure an ip address was provided
    If addr = "" Then
        'no address provided so return false
        valid = False
    Else
        'address provided so use the IsMatch Method
        'of the Regular Expression object
        valid = check.IsMatch(addr, 0)
    End If
    'return the results
    Return valid
End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.