Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select-String -pattern wholeword

Tags:

powershell

I'm trying to find all the file starting with dt and extension c* that have this precise string inside "CheckAnagrEA" The problem is that this cmdlet returns also files that have "CheckAnagrEAInsert" etc.

Here's the code:

$cnt = Get-ChildItem $githubfolder -Filter DT*.c* -Recurse -Exclude *.sql | Select-String -pattern "CheckAnagrEA"

How can i find ONLY the wholeword?

like image 880
SimoneG Avatar asked Sep 17 '25 00:09

SimoneG


1 Answers

Try the pattern

\bCheckAnagrEA\b

\b matches a word boundary. See the documentation.

like image 83
Bill_Stewart Avatar answered Sep 19 '25 17:09

Bill_Stewart