public static String lenientSubstringBetween(String s, String open, String close) {
        if (s != null && s.contains(open)) {
            String result = substringAfter(s, open);
            if (result.contains(close)) {
                return substringBefore(result, close);
            }
            return result;
        }
        return null;
    }
@Test
    void testLenientSubstringBetween() {
        assertThat(lenientSubstringBetween("open=some.string&close", "open=", "&close")).isEqualTo("some.string");
        assertThat(lenientSubstringBetween("open=some.string", "open=", "&close")).isEqualTo("some.string");
        assertThat(lenientSubstringBetween(null, "open=", "&close")).isNull();
    }