Hi
I'm using C# and I have the regex below to split words and not split a string ".. .." instead take the whole string as on item to a List.
Example:
text="all "1 dl""
after split
all[0]="all"
all[1]="1 dl"
I found it in Google and it works, but I don't understand how it works.
And if I remove the space before the last " in the string it doesn't work as I want. It seems like it splits all the characters in to elements written in the string text.
Can anybody please explain the string regexSplitter and why it has to be a space last in the string.
Many thanks
Fia
I'm using C# and I have the regex below to split words and not split a string ".. .." instead take the whole string as on item to a List.
Example:
text="all "1 dl""
after split
all[0]="all"
all[1]="1 dl"
I found it in Google and it works, but I don't understand how it works.
string regexSpliter = @"(?<=^(?:[^""]*""[^""]*"")*[^""]*) ";
List<string> all =new List<string>_ (System.Text.RegularExpressions.Regex.Split(text, regexSpliter));
And if I remove the space before the last " in the string it doesn't work as I want. It seems like it splits all the characters in to elements written in the string text.
Can anybody please explain the string regexSplitter and why it has to be a space last in the string.
Many thanks
Fia