I would like to use the .Net Regex.Split method to split this input string into an array. It must split on whitespace unless it is enclosed in a quote.
Input: Here is ‘my string’ it has ‘six matches’
Expected output:
- Here
- is
- my string
- it
- has
- six matches
What pattern do I need? Also do I need to specify any RegexOptions?
No options required
Regex:
C#:
Or if you need to exclude ‘ characters: