What I need to know is if there is a way to find out the number of times a phrase appears in a file. I'm creating a site search and need to know this for frequency. I know its easy enough to find out of a phrase appears in a file, but how do you find out how many times it appears?
Added:
Let me say, I'd like to do this without searching the file for the first occurrance of the word, then splitting the file after the first occurrance,and then searching the rest of the file, and so on for each occurance.