public static String convertLikePatternToRegex(final String pattern) {
        String result = pattern;
        if (pattern.contains("_")) {
            result = SINGLE_CHARACTER_PATTERN.matcher(result).replaceAll("$1.");
            result = SINGLE_CHARACTER_ESCAPE_PATTERN.matcher(result).replaceAll("_");
        }
        if (pattern.contains("%")) {
            result = ANY_CHARACTER_PATTERN.matcher(result).replaceAll("$1.*");
            result = ANY_CHARACTER_ESCAPE_PATTERN.matcher(result).replaceAll("%");
        }
        return result;
    }
@Test
    void assertConvertLikePatternToRegexWhenEndWithPattern() {
        assertThat(RegexUtils.convertLikePatternToRegex("sharding_"), is("sharding."));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding%"), is("sharding.*"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding%_"), is("sharding.*."));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding\\_"), is("sharding_"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding\\%"), is("sharding%"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding\\%\\_"), is("sharding%_"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding_\\_"), is("sharding._"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding%\\%"), is("sharding.*%"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding_\\%"), is("sharding.%"));
        assertThat(RegexUtils.convertLikePatternToRegex("sharding\\_%"), is("sharding_.*"));
    }