我有这样的多行
1480438326593 addons.xpi-utils DEBUG shutdown
Run Code Online (Sandbox Code Playgroud)
我想用FINDSTRWindows CMD中的函数解析它们.
我现在的问题是参数不起作用,或者我做错了,但它应该有效.
我正在使用这个命令findstr /V /R ^\d{13},它应该使用正则表达式并在字符串的开头找到任意数字13次.
findstr /V /R ^\d 如果它以数字开头但{13}不起作用 - 这有用吗?
要返回以13位数字开头的行
findstr /r ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
Run Code Online (Sandbox Code Playgroud)
如果您希望失败(不匹配)13位数跟随更多数字(即不匹配12345678901234 more text行)的情况,请在\>末尾添加(尾随字边界).
该findstr实用程序不支持正确的正则表达式,只支持一些通配符模式,因此,没有限制量词(即{min,max})支持,也没有简写字符类\d.
以下是模式findstr支持表:
???????????????????????????????????????????????????????????????????????????????
? Character ? Value ?
???????????????????????????????????????????????????????????????????????????????
? . ? Wildcard: any character ?
? * ? Repeat: zero or more occurrences of previous character or class ?
? ^ ? Line position: beginning of line ?
? $ ? Line position: end of line ?
? [class] ? Character class: any one character in set ?
? [^class] ? Inverse class: any one character not in set ?
? [x-y] ? Range: any characters within the specified range ?
? \x ? Escape: literal use of metacharacter x ?
? \<xyz ? Word position: beginning of word ?
? xyz\> ? Word position: end of word ?
???????????????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
请注意,添加\v选项将反转结果:您将获得所有不以13位数开头的行.