我在命令提示符中使用以下命令在html文件中搜索urls
findstr /r "//i\.4cdn\.org/pol/\d+\.(?:png|jpg|jpeg|webm|gif)" pol.html
regex在Notepad++搜索中运行良好,但是当我使用findstr命令运行它时,它返回它的帮助页面,如下所示:
FINDSTR: // ignored
FINDSTR: /\ ignored
FINDSTR: /. ignored
FINDSTR: /4 ignored
FINDSTR: /c ignored
FINDSTR: /d ignored
FINDSTR: /\ ignored
FINDSTR: /. ignored
FINDSTR: /g ignored
FINDSTR: // ignored
FINDSTR: // ignored
FINDSTR: /\ ignored
FINDSTR: /d ignored
FINDSTR: /+ ignored
FINDSTR: /\ ignored
FINDSTR: /. ignored
FINDSTR: /( ignored我是新来的,所以如果有什么不对劲的地方,请提前道歉。
发布于 2015-06-05 10:00:30
有意思,请参阅computing.net。可能您需要避免双正斜杠:
如果您需要使用findstr实际搜索"//“,请使用反斜杠"\/\/”进行转义。
而且,findstr似乎有一个非常基本的regex实现。见支撑元字符。
\d可能不支持速记(使用[0-9])+,甚至似乎没有+量词可用,只有*支持。(?:png|jpg|jpeg|webm|gif)可能根本不支持组https://stackoverflow.com/questions/30663158
复制相似问题