Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Can anybody help how to find Specific word in txt file using Filestream or any other object
Posted
Comments
demouser743 19-Nov-11 4:37am    
Show us the content of your text file and what you would like to find out from that

1 solution

There are a huge variety of ways! Here is one:
C#
string text = File.ReadAllText(@"D:\Temp\MyLargeTextFile.txt");
MatchCollection matches = Regex.Matches(text, @"\shorrible\s");
foreach (Match match in matches)
    {
    Console.WriteLine("\"{0}\" at {1}", match.Value, match.Index);
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900