The requirement is to get the exact match count for a word "test". So in the following example it should be 1:
testing 1 2 3 "test" testing
Tester testing 2345 tes testers testings testing
test
I tried the below code :
(Get-Content "C:\Users\abc\Desktop\POC\Findstring.txt" |
Select-String -Pattern "test" -AllMatches).matches.count
But it provides me the value as 9 since it provides a like functionality (it is also considering tester,testing etc in the count).
How should we ensure that we get the count for exact match and not for a LIKE operator scenario (similar to in SQL).