Find Complex Strings

How to find complex strings on your computer

The Find utility is limited to simple searches where the string is
straightforward. If you want to perform a complex search, you need
the FindStr utility, which can perform standard, case insensitive,
wildcard, and regular expression searches.

For example, to find TXT files that have words that begin with H and
end with o, you can type FindStr “H*o” *.TXT and press Enter. In this
case, the asterisk (*) acts as a wildcard character. Likewise, if you
wanted to find TXT files that contain the words Hello or World (or both),
you can type FindStr “Hello World” *.TXT and press Enter. If the file must
contain both words as a discrete string, then you use the /C command line
switch by typing FindStr /C:”Hello World” *.TXT and pressing Enter.

Regular expressions are an impressive FindStr feature. For example,
if you want to find TXT files that contain Hello at the beginning of
the line and World at the end of the line, you’d type FindStr “^Hello
$World” *.TXT and press Enter.

The caret (^) indicates that Hello must appear at the beginning of the
line and the dollar sign ($) indicates that World must appear at the end
of the line. As with many utilities, type FindStr /? and press Enter to
obtain a full list of features.

email me