[ad_1]
try -replace to delete substrings by regex patterns
PS> $string1="abc_xyz-mnq_R81"
PS> $string2="abc_xyz-mnq_R82"
PS> $string1 -replace "^.*_R"
81
PS> $string2 -replace "^.*_R"
82
0
[ad_2]
solved Unable to trim string in PowerShell
[ad_1]
try -replace to delete substrings by regex patterns
PS> $string1="abc_xyz-mnq_R81"
PS> $string2="abc_xyz-mnq_R82"
PS> $string1 -replace "^.*_R"
81
PS> $string2 -replace "^.*_R"
82
0
[ad_2]
solved Unable to trim string in PowerShell