1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Regular expression FOR/DIR

Discussion in 'Support' started by nickles, Aug 8, 2011.

  1. nickles

    Joined:
    Jun 24, 2008
    Messages:
    220
    Likes Received:
    0
    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
     
  2. Peter Bratton

    Joined:
    Jul 1, 2008
    Messages:
    81
    Likes Received:
    0
    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
     
  3. nickles

    Joined:
    Jun 24, 2008
    Messages:
    220
    Likes Received:
    0
    Thanks for your answer Peter! This solves it.

    @rconn

    Please update the documentation under "Wildcards and Regular Expressions". The example at the very bottom reads

    nickles
     

Share This Page