|I have a project similar to the d2c routine that I |
got help on here (much thanks!):
This time, I'm trying to create a d2b, where
decimals go in, binary representation comes
out. I got that part working by looping through
using %dec%%%2 to get the remainder, then
%dec%/2. Rinse. Repeat. Now I'm trying to
filter what's coming in as decimal, and I'm
attempting to verify that whatever is passed in
is all numbers, or numbers delimited by
space. Foolish me, I thought it would be easy
using FINDSTR's regex capabilities, similar to:
FOR /F "delims=" %%a IN ('ECHO %*^|FINDSTR /R "[^0-9]"') DO (
IF DEFINED NaN (
CALL All.numbers "%~nx0" "%*"
... process decimals...
where "All.numbers" is another routine that
scrubs sets of text and digits, and returns only
a group of digits, space delimited.
Unfortunately, the above only works if the
returned (or initial) argument is a solid string of
numbers. I believe what is happening is [^0-9]
is interpreting delimiting spaces as not a
number. How can I include spaces as
something that is acceptable?
I'm also curious about the following results
from a command prompt:
C:\>@echo 1234567890|FINDSTR /R "[^0-9]"
C:\>@echo 1234567890|FINDSTR /R "[^0-9]*"
I would have thought I'd get the same <NUL>
response both times. Thanks for any insight
and/or alternatives that you may all have!