What is the best way to remove all text in a string after a specific character? In my case "=" and after another character in my case a ,, but keep th
,
This should do what you want:
C:\PS> if ('=keep this,' -match '=([^,]*)') { $matches[1] } keep this