The output that i get keeps repeating.

For example,
strInput= "orange~banana~banana~apple"
but what i get is this
output= "orange~orange banana~orange banana banana~orange banana banana apple"

I'm pretty sure my regex is right. Any help would be much appreciated. Thanks!

 using (StreamWriter write = new StreamWriter(filePath, true))
 {

string[] line = strInput.Split('~');
foreach (string part in line)
{

 MatchCollection matches1 = Regex.Matches(part, @"\d{2}\\");
 string range = matches1[0].Value;
 switch (range)
 {
     case "00\\":
     strFruitType += "Apple";
     break;
     case "01\\":
     strFruitType += "Orange";
     break;
     case "02\\":
     strFuitType += "Banana";
     break;
}

write.WriteLine(strFruitType+"~");

                                            }

                                        }
This question has already been answered. Start a new discussion instead.