spring version is 5.3.8

where i use fromUriString like this,it give an error result,I thank there has some bug with regex

public static void main(String[] args) { UriComponentsBuilder u = UriComponentsBuilder.fromUriString("http://10.2.128.86:9528/school/#/login-yp"); u.queryParam("code", 2); System.out.println(u.toUriString()); }

// output is http://10.2.128.86:9528/school/?code=2#/login-yp

// and i expect http://10.2.128.86:9528/school/#/login-yp?code=2

Comment From: sunqb

I think the most basic URL splicing method should be provided, just like the method I wrote myself:

``` // base concat url with params public static String urlConcat(String path, Map paramMap) { if (StringUtils.isBlank(path)) { return ""; } if (paramMap == null || paramMap.isEmpty()) { return path; }

    StringBuffer resultBuffer = new StringBuffer(path);
    if (!path.contains("?")) {
        resultBuffer.append("?");
    } else {
        resultBuffer.append("&");
    }

    String join = Joiner.on("&").withKeyValueSeparator("=").join(paramMap);
    resultBuffer.append(join);
    return resultBuffer.toString();
}

Comment From: sdeleuze

As specified in the RFC, URL fragment is always last so the current behavior looks correct to me.