我收到的字符串可以等于any + " " + str + "Y"whereany可以是任何字符串,并且字符串可以str等于"1"、"2"、"3"、"5"或。我的目标是提取字符串。"7""10"any
我想出了以下代码:
string pattern = ".* {1Y|2Y|3Y|5Y|7Y|10Y}";
string indexIDTorParse = group.ElementAt(0).IndexID;
Match result = Regex.Match(indexIDTorParse, pattern);
string IndexIDTermBit = result.Value;
string IndexID = indexIDTorParse.Replace($" {IndexIDTermBit}", "");
但它没有赋予权利any。