How to use findstr with regular expression


By default findstr does the comparison with regular expression. However, what surprised me is that the following command does not work.


 findstr “abc|def” test.txt


when test.txt has only abc in it.


According to the online tutorial such as http://www.regular-expressions.info/reference.html, abc|efg should match abc. Why?


The reason is pretty simple, findstr does not support the full range of the regular expression. It does not support ?, {n}.


Some basic things works: 


findstr “abc.*” test.txt


findstr “[0-9a-f].*” test.txt


 


 


 


Comments (0)