我正在尝试使用Regex来获取始终等于5的序列号,并始终包含单词SerialNumber
我有以下内容:
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="2880"></forms>
</authentication>
文字如下:
[Authorize]
[AttributeRouting.Web.Mvc.GET("Admin")]
public ActionResult Admin()
{
return View();
}
为什么这不起作用?
答案 0 :(得分:3)
试试这个正则表达式:
SerialNumber\s*\K\S*
<强>解释强>
SerialNumber\s*
- 匹配文字SerialNumber
,后跟0个以上的空格\K
- 忘记目前为止匹配的所有内容\S*
- 匹配任何不是空白字符的字符的出现次数。答案 1 :(得分:1)