I want to build a PowerShell script which returns everything which occurs after the occurrence of the given string. I want to run a command against a single string instead of a collection.
E.g. I want to return everything after the phrase "_blah_"
_blah_v2.3
_blah_bar_blah_v56
_blah_v42
foo
Result:
v2.3
bar_blah_v56
v42
Probably Regex would be too heavy for such operation so looking for some alternative solution I've tried this:
$Foo = "blah_v1.1"
$FooVersion = ($Foo -split '_blah_', 2)[1]
Write-Host $Foo
Write-Host $FooVersion
but it works only with a single character instead of a string. I'm not fluent in PowerShell and looking for some quick and handy solution.