简体   繁体   中英

Basic regexp difference between bash and PowerShell

The following process in bash gives different result in PowerShell. First question: Is the regex interpretation different? Second question: What should I do to get the results in bash using PowerShell?

Let's assume my directories:

0.0199
0.01991
0.01992
0.01993

In bash:

find . -name "0.019?*"

./0.01991
./0.01992
./0.01993

In PowerShell:

Child-Item -Recurse -Filter "0.019?*"

0.0199
0.01991
0.01992
0.01993

I don't want to see the file named "0.0199".

I think I found the answer to second question with the help of @Olaf. -filter doesn't accept regex.

Child-Item 0.019?[1-9]
0.01991
0.01992
0.01993

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM