On 06/19/2016 06:21 PM, Hugo wrote:
What would be the efficient way to talke this then? I tried regex:
[...]
However it doesn't quite work will all cases (besides I fear in this case a regexp could offer an unnecessary entry point for an exploit):
I don't know if you can solve this with regex alone. May depend on what exact behavior you want. Maybe just write a little function instead that splits the command line, handling quotes and such as you want. If you're not comfortable writing this, then maybe you're in over your head here.
Of course, all this wouldn't be necessary if you could change the command line instead to conform with the usual syntax. If the weird behavior you're going for is just personal preference, and there's no actual need, I'd suggest to just write the command lines in the normal way with escape sequences (i.e. "foo\\" to get a trailing backlash instead of a trailing quote).