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

DIR and regular expressions

Discussion in 'Support' started by vefatica, Jul 19, 2009.

  1. vefatica

    May 20, 2008
    Likes Received:
    The regular expressing matching in DIR is **substring** matching, unlike wildcard matching.

    And the matching is case-insensitive even though the file system is case-retentive and the regex is case-sensitive.

    This example shows both.

    v:\> dir /b ::"c.*\.bat"
    a b c.bat
    a b c.batx
    v:\> dir /b ::"c.*\.BAT"
    a b c.bat
    a b c.batx
    It would be nice if both changed in v11. IMHO the default should be matching on the whole name (like wildcards). I know I can force it with "^" and "$" but I think whole-name-matching is what's usually wanted (and the user can cforce substring matching in the regex if he wants). And since the file system (NTFS at least) is case-sensitive, allowing case-sensitive regex matching would simply give more power to the user; the user could defeat it in the regex.

Share This Page