diff --git a/js/filters.js b/js/filters.js
index a1334a7..ffbe35f 100644
--- a/js/filters.js
+++ b/js/filters.js
@@ -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 = '`' + z.slice(1, z.length-1) + '
`';
+ var re = /`(.+?)`/g;
+ return text.replace(re, function(match, code) {
+ var rr = '`' + code + '
`';
return rr;
});
};