From: Alexander Ebert Date: Wed, 18 Dec 2013 00:49:12 +0000 (+0100) Subject: Fixed regex being too greedy X-Git-Tag: 2.0.1~44 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4efc488e1370be72977a2c75f0dbd6e53e691121;p=GitHub%2FWoltLab%2FWCF.git Fixed regex being too greedy --- diff --git a/wcfsetup/install/files/js/3rdParty/ckeditor/plugins/wbbcode/plugin.js b/wcfsetup/install/files/js/3rdParty/ckeditor/plugins/wbbcode/plugin.js index b8934d1644..f214a25874 100644 --- a/wcfsetup/install/files/js/3rdParty/ckeditor/plugins/wbbcode/plugin.js +++ b/wcfsetup/install/files/js/3rdParty/ckeditor/plugins/wbbcode/plugin.js @@ -350,10 +350,10 @@ html = html.replace(/ /gi," "); // [email] - html = html.replace(/([\s\S]+?)<\/a>/gi, '[email=$2]$3[/email]'); + html = html.replace(/]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi, '[email=$2]$3[/email]'); // [url] - html = html.replace(/([\s\S]+?)<\/a>/gi, function(match, x, url, text) { + html = html.replace(/]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi, function(match, x, url, text) { if (url == text) return '[url]' + url + '[/url]'; return "[url='" + url + "']" + text + "[/url]"; @@ -375,7 +375,7 @@ html = html.replace(//gi, '[s]'); html = html.replace(/<\/s>/gi, '[/s]'); - // [sub + // [sub] html = html.replace(//gi, '[sub]'); html = html.replace(/<\/sub>/gi, '[/sub]');