FINDSTR credit card reg exp Issues with .BAT

Microsoft Windows xp professional w/serv...
February 17, 2011 at 12:41:26
Specs: Windows XP
I am trying to find a credit card string in a each file in one directory, multiple files to search. Here is what I have, but I get errors with the FindStr app, so I tried changing my logic, but I am not returning any results and I thought I would.

.....
CD %rootpath%
FOR /f "tokens=* delims=" %%a in ('dir /b') DO (
SET filename=%%a
ECHO !filename!
PAUSE
FINDSTR /C:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] >> C:\FINDSTR.TXT
PAUSE
)


See More: FINDSTR credit card reg exp Issues with .BAT

Report •


#1
February 17, 2011 at 16:41:04
Wouldn't you use the /R switch instead?

Report •

#2
February 17, 2011 at 19:08:12
It seems to be a bug in findstr (at least the version included in xp). More than 15 classes
seems to make findstr crash....


I can only suggest a workaround:

for /l %%b in (0 1 9) do (
    >> C:\FINDSTR.TXT FINDSTR /r [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%%b "%%a"
)


Report •

Related Solutions


Ask Question