Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

My struggles with regex replace and moving to lowercase..

$
0
0

So we have a string

 

for example

 

cifs shares -add "sharename" "/vol/BLAH_VOLUME/BLAH_DIRECTORY/blah_FOLDER"

 

So we can easily do a replace with

$var = 'cifs shares -add "sharename" "/vol/BLAH_VOLUME/BLAH_DIRECTORY/blah_FOLDER"'

$d = $var -replace '/vol/', '/vol/newname_'

That's all well in good. One problem.. I now only need to lowercase just that part..

obviously the whole thread we can do $d.tolower() .. But that doesn't help me

SO i'm left with 

$d

cifs shares -add "sharename" "/vol/newname_BLAH_VOLUME/BLAH_DIRECTORY/blah_FOLDER"

 

Any ideas would be greatly appreciated.

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles