Regular expression FOR/DIR

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Found the following inconsistency:

Code:
> 20110707_algol.dat
dir ::"^201\d{5,5}.*.dat$"
rem shows the file
for %i in (::"^201\d{5,5}.*.dat$") echo %i
rem doesn't show the file
I additionaly tried /f and /w switches - to no avail. Am I doing sth wrong?

nickles
 
Jul 1, 2008
81
0
71
Montreal
#2
Found the following inconsistency:

Code:
> 20110707_algol.dat
dir ::"^201\d{5,5}.*.dat$"
rem shows the file
for %i in (::"^201\d{5,5}.*.dat$") echo %i
rem doesn't show the file
I additionaly tried /f and /w switches - to no avail. Am I doing sth wrong?

nickles
Putting the double-colon inside the double-quotes got the expression working for me:
Code:
> for /w z in ("::^201\d{5,5}.*.dat$") dir %z
C:\tmp\20110707_algol.dat
C:\tmp\20110708_algol.dat
C:\tmp\20110709_algol.dat
C:\tmp\20110710_algol.dat
This syntax works with TCC Regular Expression Syntax configured for PERL, Ruby, Java, or GNU, but not grep or POSIX.

HTH
--
Peter