Regex Questions

I'm currently using the code below to extract data.  I want to change the code to perform the same function except I need to exact data based on and IP address or a domain name. For example or  I don't need to have the application do both.  I just want to replace/modify this line when I need to change the search criteria.

        Dim re As New Regex("^.*?Not\sin\sDatabase.*?$", RegexOptions.Multiline)

'working code below

Imports System.Text.RegularExpressions
Imports System.IO

        Dim re As New Regex("^.*?Not\sin\sDatabase.*?$", RegexOptions.Multiline)
        Dim sr As New StreamReader("C:\resource\input.txt")
        Dim input As String = sr.ReadToEnd()
        Dim mc As MatchCollection
        Dim sw As New StreamWriter("C:\resource\results.txt")

        mc = re.Matches(input)
        For Each m As Match In mc

Thank you in advance for your time and expertise,
Who is Participating?
Shiju SasidharanConnect With a Mentor Assoc Project ManagerCommented:
Ok try this pattern
        Dim re As New Regex("[\w\-]+(\.[\w\-]+)+", RegexOptions.Multiline)
ZeonFlashConnect With a Mentor Commented:
From  (you can test it here )


gr8lifeAuthor Commented:
Thank you very much for all your expertise and time,
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.

All Courses

From novice to tech pro — start learning today.