VB.NET Regular Expression Function

Posted on 2005-04-11
Last Modified: 2010-04-17
Hello everyone,

Can anyone give me some hints on writing a VB.NET function in .NET that will receive an argument as a string (the string is a text file's data that has been read in previously), and
will parse for something such as  _XYZsomething here_XYZ (using a regular expression) and return the string something here?

 Thank you.
Question by:Xexon
    1 Comment

    Accepted Solution

    This will give you some place to start

    Private Function parseRegEx(ByVal stringToParse As String) As String
            Dim stringToFind As Regex = New Regex(" put your expression here ")
            If InStr(stringToParse, stringToFind.ToString) Then
                Return stringToFind.ToString
                Return "String not found"
            End If
    End Function

    You can get some help building your regex expression at


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
    This article will show, step by step, how to integrate R code into a R Sweave document
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    728 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

    19 Experts available now in Live!

    Get 1:1 Help Now