I want to parse commands from a text file. The commands are of the
command “param 1” “param 2”
command “param 1” “param 2” “param 3”
Each command will have one or more parameters. Each parameter is
in “” marks, and may be one or more words. Is there a regular
that will match each command without knowing ahead of time how many
parameters there are?
I tried something like this:
line =~ /^(\S+)(?:\s+"([^"]*)")+$/
But that only matches the command and the last parameter; I believe $2
being overwritten as the match progresses. Is there a way to do this
single regular expression?