Regex Questions

Posted on 2006-05-10
Last Modified: 2010-04-23
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,
Question by:gr8life
    LVL 17

    Assisted Solution

    From  (you can test it here )


    LVL 14

    Accepted Solution

    Ok try this pattern
            Dim re As New Regex("[\w\-]+(\.[\w\-]+)+", RegexOptions.Multiline)

    Author Comment

    Thank you very much for all your expertise and time,

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now