I would like to split the string using a space, like my separator, but if there are several words enclosed in double or single quotes, I would like them to be returned as a single element.
For example, if the input line is:
CALL "C:\My File Name With Space" /P1 P1Value /P1 P2Value
The output array will be:
Array[0]=Call Array[1]=C:\My File Name With Space Array[2]=/P1 Array[3]=P1Value Array[4]=/P1 Array[5]=P2Value
How do you use regular expressions for this? I understand that there are command line parsers. I glanced at the popular one, but could not cope with a situation where you can have several parameters with the same name. In any case, instead of learning to use the command line parsing library (leave it for another day). I'm interested in learning more about RegEx features.
How would you use the RegEx function to parse it?
Chadd source share