Regex 删除除

Regex 删除除,regex,notepad++,Regex,Notepad++,样本数据: "107","34.813080","117.195.184.97","10.1.10.46","UDP","366","Source port: 3867 Destination port: 52000" "110","34.832201","10.1.10.46","117.195.184.97","UDP","1022","Source port: 52000 Destination port: 3867" "112","35.155310","10.1.10.46","1

样本数据:

"107","34.813080","117.195.184.97","10.1.10.46","UDP","366","Source port: 3867  Destination port: 52000"
"110","34.832201","10.1.10.46","117.195.184.97","UDP","1022","Source port: 52000  Destination port: 3867"
"112","35.155310","10.1.10.46","117.195.184.97","UDP","974","Source port: 52000  Destination port: 3867"
从记事本++如何删除除此之外的所有数据:

117.195.184.97
10.1.10.46
10.1.10.46
并将其格式化为:

date:117.195.184.97-117.195.184.97
date:117.195.1xx.xxx-117.195.1xx.xxx

这对我的工作非常有帮助,notepad++已经有了一个过滤器来删除重复的行,因此一旦它们被过滤掉,我就可以轻松地删除重复的行。

如果您的行始终具有相同的格式,并且您想要的字段始终是第三个,您可以使用以下方法:

搜索:
^.*?,“*?”,“(.*?”。*

替换:
日期:$1-$1

详情:

^        # start of the line
.*?","   # all until the first ","
.*?","   # all until the second ","
(.*?)"   # capture in group 1 until the next "
.*       # all until the end of the line

诀窍是搜索“非逗号”。给你: 搜索:

^.[^,]*,[^,]*,"([^,]*\.[^,]*\.[^,]*\.[^,]*)".*
并替换为

$1


-Ed

基本上,我只希望这一行(CSV中的所有行)从(“107”、“34.813080”、“117.195.184.97”、“10.1.10.46”、“UDP”、“366”、“源端口:3867”“目标端口:52000”)转到这一行:117.195.184.97(新行)。您的编辑非常正确,非常感谢。我现在非常爱您,这一切都很好!