Open gausie opened 9 years ago
I don't think it works that way. Anything inside the quotes, either single or double, will not be considered as a separator. The only things need to be escaped are the single quote ' and the double quote ". If you don't want some of the white spaces being considered as separator, why not put them in a pair of quotes?
I'm in a situation where I cannot control the input, unfortunately. Escaped spaces are accepted in shell and I'm trying to parse shell arguments. On 16 Aug 2015 7:45 pm, "Elgs Qian Chen" notifications@github.com wrote:
I don't think it works that way. Anything inside the quotes, either single or double, will not be considered as a separator. The only things need to be escaped are the single quote ' and the double quote ". If you don't want some of the white spaces being considered as separator, why not put them in a pair of quotes?
— Reply to this email directly or view it on GitHub https://github.com/elgs/splitargs/issues/3#issuecomment-131599625.
I see. Let me think about how to implement it.
Not sure if this works but here's my attempt
Thanks @greggman. The results look pretty good. I will do more test.
I needed to escape spaces outside of my quotes, and also quotes inside my quotes.
Single Argument hello\ world
Quotes of same type inside. 'hello\'world\''
If my separator is " ", I'd like "\ " not to be considered a separator.