/
#Command handler
#===============
#Start of the line
^ #Match the command name
(?<cmd>[\w\d\-\_\?]+)
#Catch as many parameters as possible
(?<params>
(
\ +
(?<pre>[^\-\\\/\w\d\s\n\r]?)
[^\"]*\k<pre>
)*
)?
#Catch as many switches as possible and save them into group
(?<switches>
(
\ +
#Switch starts with -- or - or /
(?:\-\-|\-|\/)
#Gotcha!
[\w\d\_]+
)*
)?
#At the end of the line can be some spaces
\ *$ #End of the line
/
gmx