Replace substring of variable length from a text file
You could use regex to remove items:
var result = Regex.Replace(input, "reference:[^;]*;", string.Empty, RegexOptions.IgnoreCase);
I would use regex expression in this case here is some sample code put together.
using System.Text.RegularExpressions;
string pattern = "reference\:url,[.]+?;";
string replacement= "reference:url,;";
string output = Regex.Replace(input, pattern, replacement);