I'm looking for an equivalent function to Windows' [CommandLineToArgvW](http://msdn.microsoft.com/en-us/library/bb776391.aspx). 

I have a string, which I want to break up *exactly* the way bash does it, with all the corner cases - i.e. taking into account single and double quotes, backslashes, etc., so splitting `a b "c'd" "\"e\"f" "g\\" h 'i"j'` would result into:

```
a
b
c'd
"e"f
g\
h
i"j

```

Since such a function already exist and is used by the OS/bash, I'm assuming there's a way to call it, or at least get its source code, so I don't need to reinvent the wheel.

**Edit**

To answer why I need it, it has nothing to do with spawning child processes. I want to make a program that searches text, watching for multiple regular expressions to be true in whatever order. But all the regular expressions would be input in the same text field, so I need to break them up.