protected static function extractKeyword(
        string $haystack,
        string $needle,
        &$matches = null
    ) {
        $pattern = '/' . (strpos($needle, '^') === 0 ? '' : ' ?') . $needle
            . (strrpos($needle, '$') === strlen($needle)-1 ? '' : ' ?') . '/i';

        if (preg_match($pattern, $haystack, $matches, PREG_OFFSET_CAPTURE)) {
            $m = $matches[0];
            $haystack = substr_replace($haystack, ' ', $m[1], strlen($m[0]));
            return trim($haystack);
        }
        return false;
    }