Fix url regex (#2815)

Fixed url detection in chat messages. Stops false positives such as `um.....no`
This commit is contained in:
Matthew Messinger 2016-05-04 13:46:33 -04:00 committed by LexManos
parent aa672ea69a
commit 5f74a75435

View file

@ -562,8 +562,8 @@ public class ForgeHooks
static final Pattern URL_PATTERN = Pattern.compile( static final Pattern URL_PATTERN = Pattern.compile(
// schema ipv4 OR namespace port path ends // schema ipv4 OR namespace port path ends
// |-----------------| |-------------------------| |----------------------------| |---------| |--| |---------------| // |-----------------| |-------------------------| |-------------------------| |---------| |--| |---------------|
"((?:[a-z0-9]{2,}:\\/\\/)?(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}|(?:[-\\w_\\.]{1,}\\.[a-z]{2,}?))(?::[0-9]{1,5})?.*?(?=[!\"\u00A7 \n]|$))", "((?:[a-z0-9]{2,}:\\/\\/)?(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}|(?:[-\\w_]{1,}\\.[a-z]{2,}?))(?::[0-9]{1,5})?.*?(?=[!\"\u00A7 \n]|$))",
Pattern.CASE_INSENSITIVE); Pattern.CASE_INSENSITIVE);
public static ITextComponent newChatWithLinks(String string){ return newChatWithLinks(string, true); } public static ITextComponent newChatWithLinks(String string){ return newChatWithLinks(string, true); }