i have network path and i need to get the filename to a variable for example:
$path1 = '\\192.168.10.10\bla\bla\bla\120\s$\filename.exe'
$path2 = '\\srv\c$\bla\bla\120\s$\file2.exe'
i would then want to have
$var1 = filename.exe
$var2 = filename.exe
I'm not quite sure how it can be done with regex, I want to strip everything but the last '' character and what comes after it Can anyone assist please?
-- EDIT Ok, I have found a way but it looks a bit stupid:
$temp = $path1.split('\')
$var1 = $temp[$temp.lenth -1]
there must be more elegant way for this!