Monad - where clause
Why returns following argument the public folder "Funkhaus" if there is no fi* included? Get-PublicFolder \Alle -recurse | where {$_.name -match "fi*"} | format-table name,ParentPath Name ParentPath---- ----------Funkhaus \AlleFI1 \Alle\Zentrum I thought that "match" returns only results with "fi" and something behind. I thought it should return only Name ParentPath---- ----------FI1 \Alle\Zentrum
August 4th, 2006 9:04pm

This looks like a bug. I will followup on the issue. Thanks for reporting it.
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2006 9:42pm

Actually I'm not sure... looks like this is the behaviour of -match. I tried it with dir: [baddermash] D:\viveksha> dir | where { $_.Name -match "CD*" } Directory: Microsoft.PowerShell.Core\FileSystem::D:\viveksha Mode LastWriteTime Length Name---- ------------- ------ ----d---- 4/18/2006 4:41 PM CDBurningd---s 8/23/2005 9:39 PM Cookiesd-r-- 7/21/2006 7:18 PM My Documents I think match is using a regex search. If you use -like 'fl*' it will only return the one item.
August 4th, 2006 9:55pm

Hi,The behaviour that you're seeing is correct.As Vivek says -match uses regular expression matching.The pattern fi* means match an "f" then match zero or more "i"s.So both your folders match, since each matches the f.If you want to match an "f" followed by an "i" followed by zero or more characters the correct regular expression pattern is fi.* (f followed by i followed by . followed by *).Andrew Watt
Free Windows Admin Tool Kit Click here and download it now
August 9th, 2006 11:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics