我有好几行这样的台词
1480438326593 addons.xpi-utils DEBUG shutdown我想用windows中的FINDSTR函数来解析它们。
我现在的问题是争论不起作用,或者我可能做错了,但它应该有效。
我正在使用这个命令findstr /V /R ^\d{13},它应该使用regex,并在字符串的开头找到任何数字13次。
findstr /V /R ^\d --如果它以一个数字开头,但{13}不工作--有帮助吗?
发布于 2016-11-30 09:35:46
若要返回以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]如果您想要失败(不匹配)的情况下,13位后面有更多的数字(即不匹配12345678901234 more text行),添加\> (尾随字边界)在末尾。
实用程序不支持适当的正则表达式,只支持一些通配符模式,因此不支持限位量词 (即{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 │
└───────────┴─────────────────────────────────────────────────────────────────┘请注意,添加\v选项将逆转结果:您将得到不以13位数开头的所有行。
https://stackoverflow.com/questions/40884552
复制相似问题