Improve regex to avoid slicing

This commit is contained in:
Serafeim Papastefanos 2019-07-04 14:44:34 +03:00
parent 2470192cf0
commit 94ad3b8b51
1 changed files with 3 additions and 3 deletions

View File

@ -239,9 +239,9 @@ weechat.filter('prefixlimit', function() {
weechat.filter('codify', function() {
return function(text) {
var re = /(`.+?`)/g;
return text.replace(re, function(z) {
var rr = '<span class="hidden-bracket">`</span><code>' + z.slice(1, z.length-1) + '</code><span class="hidden-bracket">`</span>';
var re = /`(.+?)`/g;
return text.replace(re, function(match, code) {
var rr = '<span class="hidden-bracket">`</span><code>' + code + '</code><span class="hidden-bracket">`</span>';
return rr;
});
};