in reply to Reg exps?
So, is there not any way to match a string of some words that is contained in a bigger string but the words are not in order?Sure there is, but that's a way of matching that has nothing to do with regexpes. A way of doing what you want is to split both strings into "words" (for whatever definition of "word" is appropriate for your problem domain - there's no universal way of splitting a string into words), then look for each of the words in your smaller string if it's in the larger string. There's a match if and only if all the words in the smaller string are found in the larger string. You should also determine when there's a match if the smaller strings contain a word more than once - may they be matched with the same word in the larger string, or must they match on different positions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reg exps?
by Anonymous Monk on Jan 14, 2010 at 15:32 UTC |