0

I need to specify a regular expression that includes | character to findstr command:

processtext.exe | findstr /R "Hello|Bye"

How do I escape it? \| does not work. Quotes fix issue with pipelining but the regex does not match although separate searches for "Hello" and "Bye" do. I'm interested in a solution for legacy shell, not powershell.

UserControl
  • 135
  • 1
  • 6
  • Have you tried encapsulating it in quotation marks? What does your entire script look like? – Reaces Feb 20 '15 at 09:24
  • Are you sure findstr supports pipe syntax (this|that matching)? Not seeing anything in the documentation. – Dan Feb 20 '15 at 09:42
  • 1
    [FINDSTR support for regular expressions is limited and non-standard](http://ss64.com/nt/findstr.html). FINDSTR does not support alternation with the `|` pipe character... – JosefZ Feb 20 '15 at 13:14

1 Answers1

0

If someone is still interested just replace the pipe with a space, like in findstr /R "Hello Bye".

Zalam
  • 1