+ /**
+ * Convert a wildcard (as used in LIKE) to a regex
+ * Slashes are escaped, slash terminators included
+ */
+ protected function likeToRegex( $wildcard ) {
+ $r = preg_quote( $wildcard, '/' );
+ $r = strtr( $r, [
+ '%' => '.*',
+ '_' => '.'
+ ] );
+ return "/$r/s";
+ }
+