public static String beforeLast(String text, String before) {
        if (!text.contains(before)) {
            return null;
        }
        return text.substring(0, text.lastIndexOf(before));
    }
@Test
    public void testBeforeLast() {
        assertEquals("Hello ", SshShellOutputStringHelper.beforeLast("Hello World", "World"));
        assertEquals("Hello World ", SshShellOutputStringHelper.beforeLast("Hello World World", "World"));
        assertEquals("Hello ", SshShellOutputStringHelper.beforeLast("Hello World Again", "World"));
        assertNull(SshShellOutputStringHelper.beforeLast("Hello Again", "Foo"));

        assertTrue(SshShellOutputStringHelper.beforeLast("mykey:ignore:hello", ":", "mykey:ignore"::equals).orElse(false));
        assertFalse(SshShellOutputStringHelper.beforeLast("ignore:ignore:world", ":", "mykey"::equals).orElse(false));
    }