是否有突出显示 findstr 匹配字符的应用程序

Is there an application which highlights findstr matching characters

我正在处理一个文件列表,其中包含 date/time 个邮票。

它们有两种可能的格式:

YYYY/MM/DD hh:mm:ss
YYYY-MM-DD hh:mm:ss

我想知道今天十二点半开始的条目是什么。

为此,我编写了以下正则表达式:

"2017[-/]09[-/]12 12:3[0-9]:[0-9][0-9]"

含义如下:

令我惊讶的是,以下条目似乎适合:

2017/09/12 13:14:36.777|__logfile_|13240|17508|CClass::Function|CRU|-1|** Releasing critical section m_Busy
2017/09/12 13:14:36.777|__logfile_|13240|17508|CClass::Function|CRU|-1|** Done with Function

我不知道哪些字符遵守我写的正则表达式,显然我不想在我遇到的每个问题上写一个 Whosebug post findstr,因此我会想知道:有没有什么工具可以验证 findstr 正则表达式并突出显示结果(这样我就可以逐步学习如何更正我的表达式)?

你的正则表达式适合我。你没说你是怎么打电话的 findstr

您需要 /R(正则表达式)和 /C(文字字符串)标志:

findstr /R /C:"2017[-/]09[-/]12 12:3[0-9]:[0-9][0-9]" logfile.txt