Expressão regular para corresponder aos argumentos do processo
Eu tenho essa string:
Process.exe /Switch=Value /Switch="C:\Path with spaces\file.txt" wrong argument
Eu gostaria de capturar estas partes:
· 1st Match: Process.exe
· 2nd Match: /Switch=Value
· 3rd Match: /Switch="C:\Path with spaces\file.txt"
· 4th Match: wrong
· 5th Match: argument
A expressão regular precisa ser para uso genérico (um processo com argumentos reais), não apenas ser adaptada para este caso.
Isso é o que estou tentando:
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