I need to mimic the operation of a terminal. So for example, if I have
"a quoted string" anotherParam
I want to get["a quoted string", "anotherParam"]
test\ folder somethingElse
shoould become["test folder", somethingElse]
How can I do it? I have been trying regex but cant seem to get it right ... the main problem being differenciating spaces, indicating next parameter, and escaped spaces which should become the same parameter
By the way, I can't use libraries only java provided classes
The current code uses
[^\s]+
So it considers anything thats not space a token, is it possible to include escaped spaces? Or perhaps theres a better way around this?