To find two or more consecutive spaces between letters:
C:\Users\harry> findstr /i /r /c:"o [ ]*w" test.txt
Hello world!
Hello world!
Translation: match lines containing 'o', two spaces, zero or more spaces, 'w'. (The square brackets are redundant, but add clarity.) Presumably, you already know that findstr /?
will give you a summary of the regular expression syntax?
As for the second part of your question: as arx already pointed out, the reason you aren't getting the results you expect is that you aren't using the /C flag. Consider your first command:
findstr -i -r "view[ ]*data.sub" "view data sub.acf"
This is interpreted as a search for any line matching either of two regular expressions, view[
and ]*data.sub
. I've done some experiments and I believe the first regex is either being discarded as improperly formed, or interpreted as requiring a match from an empty set of characters. The second regex is interpreted as follows: zero or more of ']', 'data', one arbitrary character, 'sub'. As it happens, this happens to match the same lines as the single regex you thought you were using. Not so when you take away the asterisk:
findstr -i -r "view[ ]data.sub" "view data sub.acf"
Now the second regex is interpreted as follows: exactly one ']', 'data', one arbitrary character, 'sub'. Since the string ']data' does not occur in your text, none of the lines match. Instead, you should specify /c:
findstr /i /r /c:"view[ ]data.sub" "view data sub.acf"
Now you are searching for a single regex: 'view', a space, 'data', an arbitrary character, 'sub'. This is presumably what you wanted to do.