burak Posted April 22, 2004 Posted April 22, 2004 Hello, I will start working on a project where we have to parse a string and store the words and the number of times each word appears. I know you can use the Split function to split a string into words and then I'd have to savethe words and keep a track of how many times each one appears. Does .NET already have a way to do this? Thank you, Burak Quote
leazfe Posted April 23, 2004 Posted April 23, 2004 To save a word you can use the follow expresion: (?<word>\w+) after that you will have the result in the group of your Match object: Match.Gropus("word").value If you want to save more than one word, the expresion should like : (?<desc>\w+(\s+\w+)*) In order to count how many times appears: Match.Count I hope it help you, Alvaro Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.