无需正则表达式的解决方案:
string ExtractString(string s, string tag) { // You should check for errors in real-world pre, omitted for brevity var startTag = "<" + tag + ">"; int startIndex = s.IndexOf(startTag) + startTag.Length; int endIndex = s.IndexOf("</" + tag + ">", startIndex); return s.Substring(startIndex, endIndex - startIndex);}


