Notepad ++如何仅提取所需的文本字段? [英] Notepad++ how to extract only the text field which is needed?

查看:130
本文介绍了Notepad ++如何仅提取所需的文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含大量数据的日志文件.但它会采用类似的格式.

I have a log file which has lot of data. But it would be in similar format.

示例文本:

第 1428 行:[errormessage] = 21:26:07.629 未满足验收标准.预期:0.0009999871,实际:0.007407427,窗口:[0.007407427] 在 Hello.TestAutomation.Tests.Implementation.TestExecution.MirrorTestExecutor.b__12_1(IMonitor m, MonitoringEventArgs e)第 1429 行:[errormessage] = 21:26:07.629 未满足验收标准.预期:0.0009999871,实际:0.007407427,窗口:[0.007407787] 在 Hello.TestAutomation.Tests.Implementation.TestExecution.MirrorTestExecutor.b__12_1(IMonitor m, MonitoringEventArgs e)

Line 1428: [errormessage] = 21:26:07.629 acceptance criteria not met. Expected:0.0009999871, Actual:0.007407427, Window:[0.007407427] at Hello.TestAutomation.Tests.Implementation.TestExecution.MirrorTestExecutor.b__12_1(IMonitor m, MonitoringEventArgs e) Line 1429: [errormessage] = 21:26:07.629 acceptance criteria not met. Expected:0.0009999871, Actual:0.007407427, Window:[0.007407787] at Hello.TestAutomation.Tests.Implementation.TestExecution.MirrorTestExecutor.b__12_1(IMonitor m, MonitoringEventArgs e)

现在我想在 Window: 之后过滤文本:在 [ ]: ex 对于第 1428 行,我只需要 0.007407427/[0.007407427] 分别来自整个日志文件.

Now i want to filter text after Window: which is in [ ]: ex for Line 1428, I only need 0.007407427 / [0.007407427] which ever is easy and respectively from the whole log file.

预期输出:

0.007407427

0.007407427

0.007407787

0.007407787

有什么建议吗?我找到了一个正则表达式来检测我想要什么 [([0-9,.]*?)] 但如何替换所有其他文本并只留下这个文本.

Any suggestions? I found a regular expression to detect what i want [([0-9,.]*?)] but how to replace all the other text and only leave this text left.

提前致谢.

推荐答案

使用捕获组.假设每行只有一个窗口:

Use capture groups. Assuming there is only one window per line:

查找字段:^.+Window:\[([0-9,\.]+).+

替换字段:\1

这篇关于Notepad ++如何仅提取所需的文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆