本文介绍了regex =>在两个匹配项之间提前查找c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
const string numericReg = "\\d+"; // Matches a digit character. Equivalent to [0-9].
const string realNumsReg = numericReg + b + "(\\." + b + numericReg + ")?";
const string b = "\\s*";
这个说法是正确的:
This statement is true :
private const string rte = "(?<rate>" + realNumsReg + ")" +
"(?=(?<rte1>" + b + "qs " + "))";
和
这个说法是正确的:
and
This statement is true :
private const string barl = "(?<barl>" + numericReg + ")" +
"(?=((?<q>" + b + "point to print )))";
这对于rte是正确的:
this is true for rte :
MatchCollection s = Regex.Matches
("3000 qs / min", rte , RegexOptions.IgnoreCase);
这对于barl是正确的:
this is true for barl:
MatchCollection s = Regex.Matches
("6 point to print ", barl , RegexOptions.IgnoreCase);
为什么错了?
Why is this wrong?
MatchCollection s = Regex.Matches
("6 point to print 3000 qs/ min", barl+b+rte , RegexOptions.IgnoreCase);
推荐答案
这篇关于regex =>在两个匹配项之间提前查找c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!