extracting unique strings from text file

Discussion in 'ASP .Net' started by Bubbles, Mar 3, 2004.

  1. Bubbles

    Bubbles Guest

    Hello.

    New to ASP.NET and struggling on this one.

    I have a text file with a bunch of text in it. Throughout the file
    words followed by a ":" will appear. I need to pull every such string
    out and then display all unique values.

    I am able to read the file in, but am having trouble getting regex to
    work. What regex and setting should I use?

    And how would you recommend I build a the unique list of array items
    from the full list?


    .... pressuming the text data is already in yy.text - the below code is
    NOT working and may have bugs. I know the regexp is not working.

    dim ccnt as integer
    dim gg as arraylist
    gg = new arraylist
    Dim regexp as Regex = New Regex("^(w+):$", RegexOptions.IgnoreCase )
    Dim objMatch as Match
    For Each objMatch in regexp.Matches(yy.text)
    gg.add(ltrim(objMatch.ToString()))
    ccnt = ccnt + 1
    Next
    gg.sort
    response.write(gg.count)
    dim xxx as integer
    FOR xxx = 0 TO gg.count-1
    response.write(gg(xxx))
    response.write("<br>")
    next xxx

    end sub
    Bubbles, Mar 3, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. poener
    Replies:
    4
    Views:
    495
    Matt Humphrey
    Aug 28, 2006
  2. ToshiBoy
    Replies:
    6
    Views:
    828
    ToshiBoy
    Aug 12, 2008
  3. Scott Bass
    Replies:
    4
    Views:
    109
    Tad McClellan
    May 12, 2005
  4. Andry
    Replies:
    8
    Views:
    91
    J. Gleixner
    Oct 2, 2008
  5. Token Type
    Replies:
    9
    Views:
    339
    Chris Angelico
    Sep 9, 2012
Loading...

Share This Page