I want to split the last string from given path, that string contains some numbers like 1.625.235, but this numbers vary every time. Irrespective of the number that last string should be split.
Ex:
string = "C:/chef/cache/Dynatrace-OneAgent-Windows-1.625.235.msi"
output: Dynatrace-OneAgent-Windows-1.625.235.msi
string = "C:/chef/cache/Dynatrace-OneAgent-Windows-1.181.539.msi"
output: Dynatrace-OneAgent-Windows-1.181.539.msi
This is what we tried
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-/\d.\d+.\d+/.msi").split('/')[3]
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-'/\d.\d+.\d+/'.msi").split('/')[3]
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-'\d.\d+.\d+'.msi").split('/')[3]
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-'(\d.\d+.\d+').msi").split('/')[3]
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-('/\d.\d+.\d+/').msi").split('/')[3]
- ("C:/chef/cache/Dynatrace-OneAgent-Windows-('\d.\d+.\d+').msi").split('/')[3]
'C:/chef/cache/Dynatrace-OneAgent-Windows-1.625.235.msi'.split('/').lasttry this