From: James Edward Gray II Date: 2005-05-28T03:58:48+09:00 Subject: Re: How to build an index of phrases in a phrase/sentence? On May 27, 2005, at 1:39 PM, Dan Fitzpatrick wrote: > I am trying to build an indexing structure on some phrases. Most > phrases will have 2 - 5 parts (words). The resulting array will be > dumped into an index to find the matching phrases. I don't want to > do wildcard searching on the resulting array to find the phrase. > > I would like to turn "This is some text" into > > ["This", > "This is", > "This is some", > "This is some text", > "is", > "is some", > "is some text", > "some", > "some text", > "text"] > > The order of the resulting array doesn't matter. When someone > searches for "is some" or "some text", I want it to find this > phrase. I don't want a search for "is text" to find this phrase > though. Perhaps I'm not understanding, but how does the following fail to meet your needs? "This is some text".match(/is some/i) James Edward Gray II