Question Details

No question body available.

Tags

regex powershell replace

Answers (2)

January 8, 2026 Score: 0 Rep: 3,658 Quality: Low Completeness: 80%

Summary: Read this on how to construct the Windows command line for your app:
https://www.daviddeley.com/autohotkey/parameters/parameters.htm#CPP

Reference used http://www.daviddeley.com/autohotkey/parameters/parameters.htm#WINCRULESREPH
But it may have changed since then. I'm not sure if this is the rules for argv argument processing by the process.

Note that this probably needs to be a separate pre-parse regex for the cmd.exe parser as described here. this line then gets passed to the main regex below. However I have not looked into the rules until today. I will in the future. The two rule sets can be combined (probably), but it would be instructive to have them separate to see exactly the 2 stage process results. .
https://www.daviddeley.com/autohotkey/parameters/parameters.htm#WINCMDRULES
and
https://www.daviddeley.com/autohotkey/parameters/parameters.htm#PIT

(?:^[ \t]((?>[^ \t"\r\n]+|"[^"]+(?:"|$))+)|(?!^)[ \t]+((?>[^ \t"\\\r\n]+|(?

https://regex101.com/r/w3tfXE/1

(?: ^ [ \t]
( # (1 start), Command (?> [^ \t"\r\n]+ | " [^"]+ (?: " | $ ) )+ ) # (1 end) | (?! ^ ) [ \t]+ # Delimeter ( # (2 start), Argument (?> [^ \t"\\\r\n]+ | (?
January 8, 2026 Score: 0 Rep: 3,658 Quality: Low Completeness: 60%

Note that multiple identical assertions in a row are just a single assertion.

^^^^^^^$ = ^$

https://regex101.com/r/LNebCc/1