正则表达式来后特定字符匹配 [英] Regex to match after specific characters
本文介绍了正则表达式来后特定字符匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var str = "=IIF(IsNothing(Fields!Metadata1.Value),"N/A",Fields!Metadata1.Value)";
var regexp = new Regex(@"Fields!(\w+)");
var matches = regexp.Matches(str);
本场比赛将有领域!Metadata1
,而我需要得到Metadata1
The matches will have "Fields!Metadata1" while I need to get "Metadata1"
我应该怎么改?
推荐答案
不知道C#语法,对正则表达式,请尝试:
don't know c# syntax, for regex, try:
(?<=Fields!)\w*
修改添加简短的说明:
(?< = FOO)栏
比赛栏
仅在栏
是继富
(foo是在比赛结果不是要去)(小于?= ..)
是正面看身后,零宽度断言。谷歌它的详细信息。
(?<=foo)bar
matches bar
only if bar
is following foo
(foo is not gonna in match result) (?<=..)
is positive look behind, zero-width assertion. google it for details.
这篇关于正则表达式来后特定字符匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文