我正在快速使用Notepad ++中的RegEx。每次找到MAC地址后,我将如何合并行?因此,找到具有5:和12个字符的行,每个行之间有2个字符,然后合并该行和所有后续行,直到下一个MAC
这就是我所拥有的
12:34:4b:17:3a:4a
iOS
Barney
BarneyZ/10.20.7.138
BigHouse Wireless Users
BH New Office NW corner
7
11
802.11b/g
99%
Authorized
EAP
我想要这样:
12:34:4b:17:3a:4a iOS Barney BarneyZ/10.20.7.138 BigHouse Wireless Users BH New Office NW corner 7 11 802.11b/g 99% Authorized EAP
具有CSV分隔符吗?
如何在Notepad ++中做到这一点?谢谢!
答案 0 :(得分:0)
这会将所有换行符NOT后面的MAC替换为一个空格。
\R(?!([a-f0-9]{2})(?::(?1)){5})
#一个空格或您想要的任何内容说明:
\R # any kind of linebreak (i.e. \r, \n, \r\n)
(?! # negative lookahead, make sure we haven't after
([a-f0-9]{2}) # group 1, 2 hexa characters
(?: # non capture group
:(?1) # a colon followed by same pattern as defined in group 1 (i.e 2 hexa characters)
){5} # end group, must appear 5 times
) # end lookahead
我在包含您的示例的3倍的文件中运行了此文件,它给出了:
12:34:4b:17:3a:4a iOS Barney BarneyZ/10.20.7.138 BigHouse Wireless Users BH New Office NW corner 7 11 802.11b/g 99% Authorized EAP
12:34:4b:17:3a:4a iOS Barney BarneyZ/10.20.7.138 BigHouse Wireless Users BH New Office NW corner 7 11 802.11b/g 99% Authorized EAP
12:34:4b:17:3a:4a iOS Barney BarneyZ/10.20.7.138 BigHouse Wireless Users BH New Office NW corner 7 11 802.11b/g 99% Authorized EAP