Computer Science Canada Searching stuff. |
Author: | Apage43 [ Fri Nov 28, 2003 12:45 pm ] |
Post subject: | Searching stuff. |
I want to search a text file for a string. Like a search engine, and want to get the line numbers of all matching lines, what would be the best way to do that? I've used grep to do it, but I think that makes my script OS dependent. |
Author: | Blade [ Mon Dec 01, 2003 3:23 pm ] |
Post subject: | |
whatif you read each line into an array then search the array for the file and record the element number each word is in? |
Author: | Homer_simpson [ Mon Dec 01, 2003 10:31 pm ] |
Post subject: | |
or make up a function like i made for turing called wordseparator or something that separates the works by space or any other separators... so u can search yer string for words or even sentences.... |
Author: | Blade [ Tue Dec 02, 2003 12:24 pm ] |
Post subject: | |
or you can use a function called explode() goto http://php.net |