0

Using Powershell, I have this string that needs parsing :

,,Server.domain.abc.com,I1234

I'm trying to return only the part after the last "," character (here : I1234)

I sucessfully found how to isolate it using :

[^,]+$

https://regexr.com/471q7

but how do i invert this match so I can REPLACE all that is NOT this part with nothing.

My goal is to be able to do :

$var -replace "XXXX"

and end up with only that last part.

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106
Rakha
  • 1,874
  • 3
  • 26
  • 60

0 Answers0