Page 1 of 1

several words in any order (how to)

PostPosted: Sat Nov 07, 2009 12:22 pm
by bobkoure
If you need to find posts with, say, three words in any order, you can go crazy with all the possible orders, separated with '|' chars or...
You could just use a series of "lookahead" operations.
(?=foo) means "followed by foo" and (?=.*foo) means followed by any number of chars and then foo. You can combine this with the line-start char '^' and get ^(?=.*foo) which means "start of line followed by any number of chars and then foo" - and these lookahead expressions can be stacked, so, to get a post with foo, bar and blat in any order you can use: ^(?=.*foo)(?=.*bar)(?=.*blat)

Note that there's also a negative version of this ^(?!.*blat) would be start of line not followed by any number of chars and the blat.
I'll leave it to you how to search for posts with any three words and not another word... Image link not allowed for unregistered users

PostPosted: Sat Nov 07, 2009 1:28 pm
by Quade
nice