regex - JavaScript - Remove Minecraft Color Codes from String -
i'm trying remove minecraft color codes string:
[§aannouncement§r] §4test
and searched here, tried own, no avail.
code:
module.exports.regextest = function (message) { var regex = '(?i)§[0-9a-fk-or]/g'; return message.replace(regex,''); };
now, accounts tells me that regular expression works, when parse message in post doesn't remove anything.
what wrong regex code?
edit: @anubhava help. turns out source recieving sending wrong unicode. fixed code:
console.log(message.replace(/\u00a7[0-9a-fk-or]/ig,''));
thanks help, everyone!
Comments
Post a Comment