gpt4 book ai didi

c# - Mirc 颜色代码的正则表达式替换

转载 作者:行者123 更新时间:2023-11-30 17:12:34 26 4
gpt4 key购买 nike

我正在为特殊用例制作一个小型/简单的 IRC 客户端。我想去掉其他用户从他们的 Mirc/其他类似客户端输入的 Mirc 颜色代码。

截图:

enter image description here

我已经尝试了大约 1 小时但没有成功:

string msg = string.Format("{0}\n", e.Data.Message);
//msg = Regex.Replace(msg, @"\x03(?:\d{1,2}(?:,\d{1,2})?)?", string.Empty); // Ive tried all sorts here.
txtActivity.AppendText(msg);

请帮助,在此先感谢。

编辑:

这是红色的 HelloWorld。

3
51
72
101
108
108
111
87
111
114
108
100
10

编辑 2:

enter image description here

编辑 3:

3
48
49
44
49
53
32
49
46
32
73
110
32
116
104
101
32
78
97
109
101
32
111
102
32
31
65
108
108
97
104
31
44
32
116
104
101
32
77
111
115
116
32
66
101
110
101
102
105
99
101
110
116
44
32
116
104
101
32
77
111
115
116
32
31
77
101
114
99
105
102
117
108
31
46
32
3
10

最佳答案

如果您想去除所有 BURC 代码(粗体、下划线、反色和颜色),您还可以使用如下正则表达式:

msg = Regex.Replace(msg, @"[\x02\x1F\x0F\x16]|\x03(\d\d?(,\d\d?)?)?", String.Empty);

关于c# - Mirc 颜色代码的正则表达式替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10567701/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com