public static String betweenBeforeLast(String text, String after, String beforeLast) {
        text = StringHelper.after(text, after);
        if (text == null) {
            return null;
        }
        return beforeLast(text, beforeLast);
    }
@Test
    public void testBetweenBeforeLast() {
        assertEquals("foo bar' how are",
                SshShellOutputStringHelper.betweenBeforeLast("Hello 'foo bar' how are' you", "'", "'"));
        assertEquals("foo bar", SshShellOutputStringHelper.betweenBeforeLast("Hello ${foo bar} how are you", "${", "}"));
        assertNull(SshShellOutputStringHelper.betweenBeforeLast("Hello ${foo bar} how are you", "'", "'"));

        assertTrue(SshShellOutputStringHelper.betweenBeforeLast("begin:mykey:end:end", "begin:", ":end", "mykey:end"::equals)
                .orElse(false));
        assertFalse(SshShellOutputStringHelper.betweenBeforeLast("begin:ignore:end:end", "begin:", ":end", "mykey"::equals)
                .orElse(false));
    }