notepad++ - 如何在记事本++中选择这些IP地址
问题描述
我在文本文件中有这些 IP 地址:
123.456.789.987 | 0x (8B -> 0B) |N/A
756.789.412.478 | 0x (8B -> 0B) |N/A
321.745.748.415 | 0x (8B -> 0B) |N/A
14.48.210.33 | 6x (8B -> 48B) |N/A
42.117.63.132 | 6x (8B -> 48B) |N/A
2.6.133.228 | 6x (8B -> 48B) |N/A
我只需要选择所有IP地址123.456.789.987 | 0x (8B -> 0B) |N/A
我需要完整的行,用空行替换,以这种方式留下 IP 地址:
14.48.210.33 | 6x (8B -> 48B) |N/A
42.117.63.132 | 6x (8B -> 48B) |N/A
2.6.133.228 | 6x (8B -> 48B) |N/A
解决方案
不确定要保留的 IP,但这会产生您的预期结果:
- Ctrl+H
- 找什么:
^.+0x\h+\(8B\h+->\h+0B\).+\R
- 用。。。来代替:
LEAVE EMPTY
- 取消选中匹配案例
- 检查环绕
- 检查正则表达式
- 不要检查
. matches newline
- Replace all
解释:
^ # beginning of line
.+ # 1 or more any character
0x # literally 0x
\h+ # 1 or more horizontal spaces
\( # opening parenthese
8B # literally 8B
\h+ # 1 or more horizontal spaces
-> # literally ->
\h+ # 1 or more horizontal spaces
0B # literally 0B
\) # closing parenthese
.+ # 1 or more any character
\R # any kind of linebreak (ie. \r, \n, \r\n)
给定示例的结果:
14.48.210.33 | 6x (8B -> 48B) |N/A
42.117.63.132 | 6x (8B -> 48B) |N/A
2.6.133.228 | 6x (8B -> 48B) |N/A
推荐阅读
- swift - 导航栏消失 Xcode10
- random - 如何在 vhdl 中获取 -1024 和 1024 之间的随机数
- python - Python 数三
- javascript - 如何在 JavaScript 正则表达式中替换冒号和星号特殊字符
- google-cloud-dataflow - Apache Beam/Dataflow:在转换之间传递属性
- reactjs - ReactJS:映射组件的构造函数调用了多少次?
- html - 对它应用填充后如何将背景颜色拉伸为父容器的宽度-CSS
- pyspark - 如何将外部配置文件传递给 pyspark(Spark 2.x) 程序?
- windows - 从 Win32::API 调用返回一个宽字符串
- python - 如何从我们放入的 alist 中找到均值和中位数?