Fixed regex being too greedy
authorAlexander Ebert <ebert@woltlab.com>
Wed, 18 Dec 2013 00:49:12 +0000 (01:49 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 18 Dec 2013 00:49:12 +0000 (01:49 +0100)
wcfsetup/install/files/js/3rdParty/ckeditor/plugins/wbbcode/plugin.js

index b8934d1644e81fc4717ba7b485cb691227b59eed..f214a25874527d5ecc49ed2f747e24cd0440d7f5 100644 (file)
                html = html.replace(/&nbsp;/gi," ");
                
                // [email]
-               html = html.replace(/<a .*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi, '[email=$2]$3[/email]');
+               html = html.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi, '[email=$2]$3[/email]');
                
                // [url]
-               html = html.replace(/<a .*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi, function(match, x, url, text) {
+               html = html.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi, function(match, x, url, text) {
                        if (url == text) return '[url]' + url + '[/url]';
                        
                        return "[url='" + url + "']" + text + "[/url]";
                html = html.replace(/<s>/gi, '[s]');
                html = html.replace(/<\/s>/gi, '[/s]');
                
-               // [sub
+               // [sub]
                html = html.replace(/<sub>/gi, '[sub]');
                html = html.replace(/<\/sub>/gi, '[/sub]');