I'm trying to parse command line options read from an already started process. The raw string looks like that
-skipIntro -noSplash -cpuCount=7 -exThreads=7 -enableHT -malloc=tbb4malloc_bi_x64 -hugePages -maxmem=4096 -maxvram=2048 -world=empty -showScriptErrors -mod=
Single parameters can have four different formats
- Parameter without value: -skipIntro
- Escaped parameter without value: "-skipIntro"
- Parameter with value: -mod=foo
- Escaped parameter with value: "-mod=foo"or"-mod=b ar"
Escaped parameters could include white spaces.
I want to split all parameters into an array of strings. The splitted parameters should include the prefix - respectively "-.
My regex looks like this:
\s*[\"]*?- which is working fine. However this also removes the prefix mentioned above. How can I include the prefix into the separated params array?
 
     
     
    