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:
I have absolutely no clue about regular expressions (sorry to say) and I need to return just the 184.108.40.206 bit. How do I tweak the code below to do what I need?
Dim psi As New ProcessStartInfo
.UseShellExecute = False
.RedirectStandardInput = True
.RedirectStandardOutput = True
.FileName = "nslookup"
.Arguments = "aspen-plc.co.uk"
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