* match all words, in any order * docs: match all words, in any order
@@ -359,7 +359,9 @@
function escapeRegExp( string ) {
- return string.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ); // https://stackoverflow.com/a/6969486/5250847
+ string = string.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ); // https://stackoverflow.com/a/6969486/5250847
+
+ return '(?=.*' + string.split( ' ' ).join( ')(?=.*' ) + ')'; // match all words, in any order
}
@@ -253,7 +253,9 @@