Powershell:
Help: I want to truncate this url:
https://thoudamchitaranjan.blogspot.in/2017/12/merry-christmas-and-still-merry-shes-still-so-beautiful.html
into this:
merry-christmas-and-still-merry-shes-still-so-beautiful
and store it into a variable.
I tried wildcards but wouldn't work. I tried replacing "/" with newline "`n" and tried reading the last line. Also I successfully tried the code below. The code that i used and worked is:
$rightPart="https://thoudamchitaranjan.blogspot.in/2017/12/merry-christmas-and-still-merry-shes-still-so-beautiful.html"
$rightPart=$rightPart.Replace(".html","")
while($rightPart -imatch "/"){
$pos = $rightPart.IndexOf("/")
$rightPart = $rightPart.Substring($pos+1)
}
Write-Output "String is: $rightPart"
But i want a better way. Thanks for your help in advance.