using System.Text.RegularExpressions;
private bool RegexMatch(string sSource, string sRegexFormat)
{
Regex reg = new Regex(sRegexFormat,RegexOptions.IgnoreCase);
try
{
if (reg.IsMatch(sSource))
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
}RegexMatch(stringSource, "Mbr_Elig_Term_Date IS NULL")
RegexMatch(stringSource, "ISNULL\(.*MBR_ELIG_TERM_DATE.*\)")
RegexMatch(stringSource, "ISNULL\(.{0,10}MBR_ELIG_TERM_DATE.{0,10}\)")
RegexMatch(stringSource, "ISNULL\(.{0,20}[.[]MBR_ELIG_TERM_DATE.{0,10}\)")

本文介绍了一个简单的正则表达式匹配函数实现,并通过几个示例展示了如何使用该函数来判断字符串是否符合特定的正则表达式模式。这些模式包括了对NULL值的检查,适合初学者了解正则表达式的应用。
3185

被折叠的 条评论
为什么被折叠?



