Regex help

Am using nslookup to find an ip address of a domain in code.  Found the code at the bottom somewhere.  Basically the return from nslookup (below is more than is required:

Server:  machine1.xyz.local
Address:  172.18.2.2

Non-authoritative answer:
Name:    abc-plc.co.uk
Address:  62.3.227.43

I have absolutely no clue about regular expressions (sorry to say) and I need to return just the 62.3.227.43 bit.  How do I tweak the code below to do what I need?

        Dim psi As New ProcessStartInfo
        With psi
            .UseShellExecute = False
            .RedirectStandardInput = True
            .RedirectStandardOutput = True
            .FileName = "nslookup"
            .Arguments = "aspen-plc.co.uk"
        End With

        Dim ns As Process = Process.Start(psi)
        Dim sout As System.IO.StreamReader = ns.StandardOutput
        Dim re As New System.Text.RegularExpressions.Regex(REGEX_REQUIRED_HERE)
        Dim sIPAddress As String
        Dim response As String = ""
        While (sout.Peek() > -1)
            response = sout.ReadLine()
            Dim amatch As System.Text.RegularExpressions.Match = re.Match(response)
            If (amatch.Success) Then
                sIPAddress = amatch.Groups("Address").Value
                Console.WriteLine(sIPAddress)
            End If
        End While

Regards

Wing
LVL 1
WingYipAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhanceCommented:
Why are you doing this the hard way?  The .NET runtime includes a DNS client.  See:

[Visual Basic]
Public Shared Function GetHostByName( _
   ByVal hostName As String _
) As IPHostEntry

There is an example of VB code on the MSDN page for this method that should do exactly what you want without relying on NSLOOKUP or having to parse its output.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WingYipAuthor Commented:
You may well ask.  In short no reason whatsoever.

Will use getHostByName instead

Regds

Wing
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.