PowerShell to remove text from a string

前端 未结 5 554
不思量自难忘°
不思量自难忘° 2020-12-06 09:59

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

5条回答
  •  无人及你
    2020-12-06 10:40

    This should do what you want:

    C:\PS> if ('=keep this,' -match '=([^,]*)') { $matches[1] }
    keep this
    

提交回复
热议问题