Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify whitespace in findstr on Windows?

Tags:

regex

findstr

I want to specify whitespace after a certain word (SetupAX) that I am searching in a file.

I am trying the findstr command this way -

   findstr /n /r "SetupAX[ \r\n\t]" XYZ.frm

However, this doesn't work. If I don't put the whitespace, I get results like -

   findstr /n /r "SetupAX" XYZ.frm

   158: If Filled() Then Call SetupAXForB
   170: SetupAXForC
   196: SetupAX          //<-- correct
   242: Call SetupAX     //<-- correct
   276: Call SetupAXN
   ...

How do I get around this? I only want instances of "SetupAX" and not "SetupAX...". Thanks.

like image 672
CodeBlue Avatar asked Nov 13 '22 08:11

CodeBlue


1 Answers

How about using the end of word matching expression?

findstr /n /r "SetupAX\>" XYZ.frm
like image 127
wallyk Avatar answered Dec 23 '22 11:12

wallyk