你看上去與託管元數據,術語庫ID和術語集ID :)
只需使用常規的打正則表達式(下稱 「p」 下方變量):
string c1 = "Accessibility|5102d73a-1b0b-4461-93cd-0c024738c19e";
string c2 = "5102d73a-1b0b-4461-93cd-0c024738c19e;#5102d73a-1b0b-4461-93cd-0c024733d52d";
string c3 = "|;#5102d73a-1b0b-4461-93cd-0c024738c19e;#SharePointTag|5102d73a-1b0b-4461-93cd-0c024733d52d";
string c4 = "Business pages|;#5102d73a-1b0b-4461-93cd-0c024738cz13;#SharePointTag|5102d73a-1b0b-4461-93cd-0c024733d52d";
string p = @"([a-z0-9]{8}[-][a-z0-9]{4}[-][a-z0-9]{4}[-][a-z0-9]{4}[-][a-z0-9]{12})";
MatchCollection mc;
Console.WriteLine("#1");
mc = Regex.Matches(c1, p);
foreach (var id in mc)
Console.WriteLine(id);
Console.WriteLine("#2");
mc = Regex.Matches(c2, p);
foreach (var id in mc)
Console.WriteLine(id);
Console.WriteLine("#3");
mc = Regex.Matches(c3, p);
foreach (var id in mc)
Console.WriteLine(id);
Console.WriteLine("#4");
mc = Regex.Matches(c4, p);
foreach (var id in mc)
Console.WriteLine(id);
WICH輸出:
#1
5102d73a-1b0b-4461-93cd-0c024738c19e
#2
5102d73a-1b0b-4461-93cd-0c024738c19e
5102d73a-1b0b-4461-93cd-0c024733d52d
#3
5102d73a-1b0b-4461-93cd-0c024738c19e
5102d73a-1b0b-4461-93cd-0c024733d52d
#4
5102d73a-1b0b-4461-93cd-0c024738cz13
5102d73a-1b0b-4461-93cd-0c024733d52d
Press any key to continue...
您是否使用您提供的所有示例?或者您是否希望選擇其中一個示例作爲存儲指導的方式?你能否提供你想要做的更多的信息。 – Purplegoldfish
看着你的數據結構,我在想你需要首先對你的數據結構進行排序,然後決定你想使用的分隔符。我可以看到'| ,; #' –