extracting unique strings from text file

B

Bubbles

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top