I'm trying to define a regular expression for the Split function in order to obtain all substring split by a whitespace omitting those whitespaces that are into single quotation marks.
Example:
key1:value1 key2:'value2 value3'
i Need these separated values:
key1:value1
key2:'value2 value3'
I'm tried to perform this in different ways:
- Regex.Split(q, @"(\s)^('\s')").ToList();
- Regex.Split(q, @"(\s)(^'.\s.')").ToList();
- Regex.Split(q, @"(?=.*\s)").ToList();
What i am wrong with this code?
Could you please help me with this?
Thanks in advance
k1 : v1 k2 : 'v2 v3'a valid input? And if so what output do you expect? - Aleks Andreev