我想只提取括號內的文本 - 不是括號內!目前正則表達式提取兩個delimeters之間的字符串沒有也返回delimeters?
我的代碼如下所示:
var source = "Harley, J. Jesse Dead Game (2009) [Guard]"
// Extract role with regex
m = Regex.Match(source, @"\[(.*)\]");
var role = m.Groups[0].Value;
// role is now "[Guard]"
role = role.Substring(1, role.Length-2);
// role is now "Guard"
你能幫我簡化這只是一個單一的正則表達式,而不是正則表達式,那麼子?
非常感謝你:) – 2010-04-30 06:16:03