我有这样一个简单的,很简单的正则表达式:仅获得整数值
private static string FORMAT_REGEX = @"\{(\d)\}";
我有一个像I have {323} dollars
一个字符串,我想只有323
当我使用:
Regex regex = new Regex(FORMAT_REGEX);
Match match = regex.Match(format);
if (match.Success)
{
return match.Groups[0].Value; // here comes {323} instead of 323
}
我敢肯定,我的模式是错误的。什么是正确的模式?