View Single Post
Old 06-30-2006   #1 (permalink)
Bob Weiner


 
 

-replace operator

This is probably a regex question as opposed to powershell but I am confused
by an example of the -replace operator on page 89 in the user guide:

> "abc" -replace "\w*", "new"

newnew

Why does this match twice? It seems to me that if \w* is greedy, it should
take them all. If it is not, it should grab "", "a", "ab", "abc".

The
> "abc" -replace "\w?", "new"

example is similar.

bob

My System SpecsSystem Spec