DIR probably won't do it on its own
You certainly wouldn't need to use loops!!!!
You just need a list of filenames (which you can get from DIR /b... >a.a), redirecting output to a file eg a file called a.a, and apply a regex to them.
Lots of programs use regexes and let you test the regex.. Notepad++ probably supports regexes and is free. I use JGSoft editpad pro sometimes.
Lots of useful programs use regexes, like regex renamer, or powergrep.. regex coach helps to put together a regex. Even grep of course uses regexes.. It's good to know regexes!
If you want to figure out a regex from the command line then using echo and grep is a good idea. e.g. echo abc | grep ab
C:\blahblah>dir /b >a.a
C:\blahblah>type a.a
gfgdfgdf.doc
sdfs.ewerw.txt
C:\blahblah>grep -P "[^.]+\.[^.]+\...." a.a
sdfs.ewerw.txt
C:\blahblah>
That lists all filenames that match the pattern of some sequence of one or more characters that aren't a dot, followed by a dot followed by some sequence of one or more characters that aren't a dot. Followed by a dot, followed by three characters.
You would have to get grep, mine seems to be a fairly recent version I got from cygwin
C:\blahblah>grep --version
grep (GNU grep) 3.7
Packaged by Cygwin (3.7-2)
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
C:\blahblah>
Another answer mentions findstr, that might better for you as it's native. Though note that findstr doesn't support PCRE(perl compatible regular expressions), so some of its regex options are a bit limited. e.g. PCRE includes support of looking for \d{3}
which would match 3 consecutive digits. Or lookahead/lookbehind. (?=1)
. So if you are interested in regexes, findstr is limiting.
dir
command?" No