Joel Francis I just installed PS Core 6.1.1 and got similar results as you. I also tested your array index method and it's even faster than .EndsWith():
RegEx method: 125 ms
EndsWith method: 17 ms
Like method: 52 ms
Array index method: 9 ms
Code for array index method:
$stopwatch = [Stopwatch]::StartNew();
for ($i = 0; $i -lt 100000; $i++) {
$boolValue = 'something\'[-1] -eq '\'
}
"Array index method: $($stopwatch.ElapsedMilliseconds) ms "
Also, the times in my previous comment were generated using the play button (Run Script) in Windows PowerShell ISE, which adds debugging overhead. When I run it directly in PowerShell.exe (5.1.1) I get similar results to PS Core:
RegEx method: 127 ms
EndsWith method: 23 ms
Like method: 44 ms
Array index method: 14 ms
(In the end, unless you're checking the ends of many strings or performance matters a lot, it doesn't really matter what method you use. Personally I'll probably stick with -Like because I like it. ;)