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

Regex help - everything before the last '\' in a string

$
0
0

Good Afternoon,

I am trying to use -replace to modify a string - I need the regex to be able to provide me with everything in the string up to and including the last backslash within that string.

Current string:

'\\server\path\to\user\directoryname'

Replaced string:

'\\server\path\to\user\'

Please could someone help me with this?

Thanks,


Viewing all articles
Browse latest Browse all 6937

Trending Articles