Why does findstr not handle case properly (in some circumstances)?

后端 未结 4 1437
名媛妹妹
名媛妹妹 2020-11-29 07:08

While writing some recent scripts in cmd.exe, I had a need to use findstr with regular expressions - customer required standard cmd.exe commands (no GnuWin32 no

4条回答
  •  既然无缘
    2020-11-29 07:18

    Everyone above is wrong. The alpha chars order is the follwoing: aAbBcCdDeE..zZ so echo a | findstr /r "[A-Z]" returns nothing, since a is outside of that range.

    echo abc|findstr /r "[A-Z][A-Z][A-Z]" also returns nothing, since first range group matches b, second one matches c and the third one matches nothing and thus the whole regex pattern finds nothing.

    If you like to match any character of latin alphabet - use [a-Z].

提交回复
热议问题