I have written the folllowing regex and would like to get empty strings removed automatically and could not find any equivalent to RemoveEmptyEntries for Regex which I found only for the Split method in string.
string test = "{ key1 = { key2= xx } | key3 = y | key4 = z }";
string[] help = Regex.Split(test, "(=)|({)|(})|(\\|)");
The result string array contains elements which are empty. I would like to run the regular expression without yielding any empty strings contained in the result.
I will run this code very, very frequently - thus I need it as efficient as possible. Updates: As this is a parser I need to keep the tokens and I found only a way with Regex to keep them.