use weechat functions instead of regex
(using regex is still inevitable)