@Override
    public String getProperty(String key) {
        String value = super.getProperty(key);
        if (value != null) {
            return value;
        }

        // Sort the keys to solve the problem of matching priority.
        List<String> sortedKeyList = keySet().stream()
                .map(k -> (String) k)
                .sorted(Comparator.reverseOrder())
                .collect(Collectors.toList());

        String keyPattern = sortedKeyList.stream()
                .filter(k -> {
                    String matchingKey = k;
                    if (matchingKey.startsWith(CommonConstants.ANY_VALUE)) {
                        matchingKey = CommonConstants.HIDE_KEY_PREFIX + matchingKey;
                    }
                    return Pattern.matches(matchingKey, key);
                })
                .findFirst()
                .orElse(null);

        return keyPattern == null ? null : super.getProperty(keyPattern);
    }
@Test
    void testGetProperty() {
        RegexProperties regexProperties = new RegexProperties();
        regexProperties.setProperty("org.apache.dubbo.provider.*", "http://localhost:20880");
        regexProperties.setProperty("org.apache.dubbo.provider.config.*", "http://localhost:30880");
        regexProperties.setProperty("org.apache.dubbo.provider.config.demo", "http://localhost:40880");
        regexProperties.setProperty("org.apache.dubbo.consumer.*.demo", "http://localhost:50880");
        regexProperties.setProperty("*.service", "http://localhost:60880");

        Assertions.assertEquals(
                "http://localhost:20880", regexProperties.getProperty("org.apache.dubbo.provider.cluster"));
        Assertions.assertEquals(
                "http://localhost:30880", regexProperties.getProperty("org.apache.dubbo.provider.config.cluster"));
        Assertions.assertEquals(
                "http://localhost:40880", regexProperties.getProperty("org.apache.dubbo.provider.config.demo"));
        Assertions.assertEquals(
                "http://localhost:50880", regexProperties.getProperty("org.apache.dubbo.consumer.service.demo"));
        Assertions.assertEquals("http://localhost:60880", regexProperties.getProperty("org.apache.dubbo.service"));
    }