Wyrażenie regularne do dopasowania argumentów procesu
Mam ten ciąg:
Process.exe /Switch=Value /Switch="C:\Path with spaces\file.txt" wrong argument
Chciałbym uchwycić te części:
· 1st Match: Process.exe
· 2nd Match: /Switch=Value
· 3rd Match: /Switch="C:\Path with spaces\file.txt"
· 4th Match: wrong
· 5th Match: argument
Wyrażenie regularne musi być używane do ogólnego użycia (proces z prawdziwymi argumentami), nie tylko dostosowane do tego przypadku.
To właśnie próbuję:
Dim DebugArguments As String =
"HotkeyMaker.exe /Hotkey=Escape /run=""c:\folder with spaces\notepad.exe"""
For Each match As Match In Regex.Matches(DebugArguments, "([^\s]+[^""])")
MsgBox(match.Value)
Next match