View Single Post
Old 12-17-2007   #1 (permalink)
Jarod
Guest


 
 

How to work with regular expressions

Hi!

When I do:


dir | where { $_.Name -match "\d+" }

It displays names containing numbers.
What if I want to have just those matched numbers?

So if the file name is : powerShell_01.txt
I want to have this 01 how to get this?

Later on I'd like to convert it to a number so if it's
0001 or 001 or 000001 it's just 1.

and rename files

Thx for help with this.

Jedrzej

My System SpecsSystem Spec