REGEX NON MATCHING - LINES NOT CONTAINING STRING LOGIC

Discussion in 'ASP .Net' started by jason, Oct 25, 2003.

  1. jason

    jason Guest

    The following vb code displays every line that has a particular string
    in it. How do I list every line that does not have that string. "!"
    does not seem to work for me and not sure where to place it in match
    logic.


    <vb code>

    readin("linetest.txt")
    dim linex as string
    linex="line"

    Dim xxx as string
    xxx = "^(.+)"+linex+"(.+)$"
    Dim regexp2 as Regex = new Regex (xxx, RegexOptions.IgnoreCase or
    RegexOptions.Multiline )


    Dim objMatch as Match
    dim z as string
    For Each objMatch in regexp2.Matches(session("readin"))
    z = objMatch.ToString()
    response.write(z + "<br>")
    Next

    </vb code>

    Thanks in advance for any help or info.
     
    jason, Oct 25, 2003
    #1
    1. Advertisements

  2. The caret ^ is usually used inside a char grouping to specify 'all chars
    but these'....check out regexlib.com, here's there cheat sheet:

    http://regexlib.com/CheatSheet.htm

    a very good site where you can even test your expression...
     
    Craig Deelsnyder, Oct 25, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.