我必须从 url 而不是 jsessionid 字符串中获取 jsessionid 代码。可以匹配某些东西并排除它吗?
https://esgf-data.dkrz.de/esgf-idp/idp/login.htm;jsessionid=436100313FAFBBB9B4DC8BA3C2EC267B
Result = 436100313FAFBBB9B4DC8BA3C2EC267B
从评论中添加的代码:
Pattern pattern = Pattern.compile("/jsessionid=([a-z0-9]+)/i");
Matcher matcher=pattern.matcher(connection.getURL().toExternalForm());