It is a bit pushing the edge, but I have the following situation with this regular expression - "()" : When used to split a string into a string[] array, the results are somewhat weird to me. For example this line of code :
string[] res = new Regex("()").Split("hi!");
sets res
to an array of 9 (!) elements : ["","","h","","i","","!","",""]
I am expecting it to return these 5 elements instead : ["h", "", "i", "", "!" ]. The reason I need this particular result is for compatibility with another regexp library ...
My question is, could this behavior be due to some missing options of the regular expression object or some encoding problem or similar ... Or it is determined in some way and is definitely the correct way it should work ? Also, is there a way to force it to return the second (expected) result instead ?