/^(?=.*\b<word1>)(?=.*\<word2>)/
- Good for typeahead search with MongoDB, because it matches words in any order. To use, split a query string by spaces, then insert each word into the regex surrounded by parenthesies with forward lookahead ((?=.* )
). Here, I've included the \b which matches the start of a word, to ensure users' results aren't cluttered by random letters in the middle of words. (http://rubular.com/r/hnOalIdRYA)
https://gist.github.com/gruber/8891611 - Best one I've seen for matching web URLS