summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-03-23 13:26:03 +0000
committerKHobbits <rob@khobbits.co.uk>2012-03-23 13:26:03 +0000
commiteb92819e361cceff0ab391c5d65150e4af639fa9 (patch)
treeef19295f20099cb7f8ba204e472ad3019f46642b
parent394155dfcba70a50fb29e58907b9068924067f58 (diff)
downloadEssentials-eb92819e361cceff0ab391c5d65150e4af639fa9.tar
Essentials-eb92819e361cceff0ab391c5d65150e4af639fa9.tar.gz
Essentials-eb92819e361cceff0ab391c5d65150e4af639fa9.tar.lz
Essentials-eb92819e361cceff0ab391c5d65150e4af639fa9.tar.xz
Essentials-eb92819e361cceff0ab391c5d65150e4af639fa9.zip
Fix url matching.
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index 48eb770b2..510ab8a9a 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -495,7 +495,7 @@ public class Util
}
return buf.toString();
}
- private static transient final Pattern URL_PATTERN = Pattern.compile("^((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)$");
+ private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]");
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]");
@@ -529,7 +529,12 @@ public class Util
{
return null;
}
- return URL_PATTERN.matcher(input).replaceAll("$1 $2");
+ String text = URL_PATTERN.matcher(input).replaceAll("$1 $2");
+ while (URL_PATTERN.matcher(text).find())
+ {
+ text = URL_PATTERN.matcher(text).replaceAll("$1 $2");
+ }
+ return text;
}
public static String formatString(final IUser user, final String permBase, final String input)