Why "d:\0.0" doesn't substring of "D:\0.0" while using "findstr" command of Windows command prompt

StackOverflow https://stackoverflow.com/questions/21876543

  •  13-10-2022
  •  | 
  •  

Question

I'm using "findstr" command with case-insensitive option (/I flag),
and I can't explain the results below.

echo "D:\0.0" | findstr /I "d:\0"

Output: "D:\0.0"

echo "D:\0.0" | findstr /I "d:\0.0"

Output:


why "d:\0.0" doesn't substring of "D:\0.0"?

Was it helpful?

Solution

Because you are searching for a regexp rather than a substring:

>echo "D:\0.0" | findstr /I "D:\0.0"

gives nothing either. You want to add the literal flag /l

>echo "D:\0.0" | findstr /I /l "d:\0.0"

gives:

"D:\0.0"

If you want to use the regexp, you need to escape the dot

>echo "D:\0.0" | findstr /I "d:\0\.0"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top