From adf048b55c4cdb56adbc1273eda5ddd0067a016b Mon Sep 17 00:00:00 2001 From: Pascal Essiembre Date: Mon, 14 Aug 2023 01:27:36 -0400 Subject: [PATCH] Fixed regex regression. --- src/main/java/com/norconex/commons/lang/url/HttpURL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/norconex/commons/lang/url/HttpURL.java b/src/main/java/com/norconex/commons/lang/url/HttpURL.java index 1db60b63..83224469 100644 --- a/src/main/java/com/norconex/commons/lang/url/HttpURL.java +++ b/src/main/java/com/norconex/commons/lang/url/HttpURL.java @@ -361,7 +361,7 @@ public static String getRoot(String url) { if (StringUtils.isBlank(url)) { return null; } - return url.replaceFirst("^(.*?://.+?)([/?#]|$)", "$1"); + return url.replaceFirst("^(.*?://[^/?#]+).*", "$1"); } /**