Regex expression or batch mode

How can I write a regex expression with OR in a package. I have a file and I want to find "aa" or "bb". The file contains the following lines:

aa
bb
cc

This is the command I tried:

findstr /I /R /C:"aa\|bb" temp.txt

and

findstr /I /R /C:"aa|bb" temp.txt

Can someone help me with OR syntax in batch mode for writing regular expressions.

Thank.

+3
source share
2 answers

Quote from the document:

FINDSTR does not support striping with pipe (|), multiple regular expressions can be separated by spaces, just like multiple words (provided that you do not specify a literal search with / C), but this may not be useful if the regular expression itself contains spaces.

: http://ss64.com/nt/findstr.html

+3

findstr , , . , findstr

findstr /i /c:"aa" /c:"bb" temp.txt
0

All Articles