在配置 appsetting 中使用带引号的字符串,用“|”分隔 并使用正则表达式匹配关键字从输入字符串中查找模式
<add key="SignatureWord" value="IN WITNESS|For this purpose|Please confirm your agreement|Acknowledged and Agreed|EXECUTED by the parties|(i) Any amount (the "Early Termination Amount")"/>
public bool isSignature()
{
NodeVal="(i) Any amount (the \"Early Termination Amount\") payable to one party (the \"Payee\")by the other party (the \"Payer\") under Section 6(e)";
bool isSignature = false;
string kWordforSignature = ConfigurationSettings.AppSettings["SignatureWord"].ToString();
Match mObj = Regex.Match(NodeVal, @"\b" + kWordforSignature + @"\b", RegexOptions.Singleline | RegexOptions.IgnoreCase);
if ((mObj.Success) && (NodeVal.IndexOf(mObj.ToString().Trim()) == 0))
{
isSignature = true;
}
return isSignature;
}
在应用程序设置中定义的关键字“(i)任何金额(“提前终止金额”)”的情况下不起作用,而所有其他关键字(如“IN WITNESS”等)都可以正常工作