使用标准Windows可执行文件进行Regex搜索



我想使用.bat文件中的regex匹配来验证控制台输入。

有没有标准windows安装附带的.exe可以帮助我做到这一点?

即在linux上具有类似grep功能的东西。

您可以使用findstr,它有一些Regex功能(但没有PCRE,没有grep-o)。这是imo唯一一个支持Regex的EXE
SS64和Microsoft的语法。

示例:

findstr "pattern" "file"
echo %date%|findstr /e "[0-2]"  # true for 2012, false for 2013

命令行上有一个小的帮助文本:findstr /?

让我为你谷歌一下:

  • http://social.technet.microsoft.com/wiki/contents/articles/4310.powershell-working-with-regular-expressions-regex.aspx
  • http://technet.microsoft.com/en-gb/magazine/2007.11.powershell.aspx
  • http://www.gfi.com/blog/windows-powershell-extracting-strings-using-regular-expressions/

最后一个是shell脚本。

两个工具-批处理文件-由这里的正则化人员设计,它们具有regexp功能。

findrepl:-http://www.dostips.com/forum/viewtopic.php?f=3&t=4697

回复:-http://www.dostips.com/forum/viewtopic.php?f=3&t=3855

VB脚本也可以处理正则表达式。

最新更新