From a70895affd333d0e815cdbd21babe7e5aeb66821 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 13 Oct 2015 22:55:34 +0200 Subject: [PATCH] Fixed middle dot in URL Closes #920 --- app/js/lib/ng_utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index 4377e44f..96c737dc 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1109,6 +1109,8 @@ angular.module('izhukov.utils', []) var alphaNumericRegExp = "0-9\_" + alphaCharsRegExp; + var domainAddChars = "\u00b7"; + // Based on Regular Expression for URL validation by Diego Perini var urlRegExp = "((?:https?|ftp)://|mailto:)?" + // user:pass authentication @@ -1118,9 +1120,9 @@ angular.module('izhukov.utils', []) "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}" + "|" + // host name - "[" + alphaCharsRegExp + "0-9][" + alphaCharsRegExp + "0-9\-]{0,64}" + + "[" + alphaCharsRegExp + "0-9][" + alphaCharsRegExp + domainAddChars + "0-9\-]{0,64}" + // domain name - "(?:\\.[" + alphaCharsRegExp + "0-9][" + alphaCharsRegExp + "0-9\-]{0,64}){0,10}" + + "(?:\\.[" + alphaCharsRegExp + "0-9][" + alphaCharsRegExp + domainAddChars + "0-9\-]{0,64}){0,10}" + // TLD identifier "(?:\\.(xn--[0-9a-z]{2,16}|[" + alphaCharsRegExp + "]{2,24}))" +