export class HtmlTools {
    static escapeHtml (text) {
        return text.replace(/[\"&<>]/g, a => HtmlTools._escapeCharMap[a]);
    }

    static anchorLinksEscapeHtml (text) {
        var linkRegex = /((https?:\/\/|www\.|[^\s:=]+@www\.).*?[a-z_\/0-9\-\#=&])(?=(\.|,|;|\?|\!)?("|'|«|»|\[|\s|\r|\n|$))/g;
        
        var parts = [];
        
        var match;
        var lastEnd = 0;
        while (match = linkRegex.exec(text)) {
            if (match.index != lastEnd) {
                parts.push(HtmlTools.escapeHtml(text.substring(lastEnd, match.index)));
            }
            parts.push("<a href='" + match[0] + "' target='_blank'>" + match[0] + "</a>");
            lastEnd = linkRegex.lastIndex;
        }

        if (lastEnd < text.length) {
            parts.push(HtmlTools.escapeHtml(text.substring(lastEnd)));
        }

        return parts.join('');
    }
}

HtmlTools._escapeCharMap = { '"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;' };

@@ -212,16 +212,27 @@
 s?:%5C/%5C/%7C
+ftps?:%5C/%5C/%7C
 www%5C.%7C%5B%5E
@@ -251,16 +251,19 @@
 ).*?%5Ba-z
+A-Z
 _%5C/0-9%5C-
@@ -279,16 +279,18 @@
 (%5C.%7C,%7C;%7C
+:%7C
 %5C?%7C%5C!)?(

Fix regex for html links parsing.