public static string MatchZurichPolicyNumber(string src) { var config = new RegexConfig(); config.Pattern = @"Z[A-Z]{2}[0-9a-zA-Z]{7,10}ZC"; var reg = new Regex(config.Pattern, RegexOptions.IgnoreCase); var matches = reg.Matches(src); if (matches.Count > 0) { var match = matches.Cast <Match>().FirstOrDefault(); if (match != null) { return(match.Value); } } return(null); }
public static string MatchDahSingPolicyNumber(string src) { var config = new RegexConfig(); config.Pattern = @"[0-9a-zA-Z]{6}(P|C)MV[0-9]{2}-[0-9]{1}"; var reg = new Regex(config.Pattern, RegexOptions.IgnoreCase); var matches = reg.Matches(src); if (matches.Count > 0) { var match = matches.Cast <Match>().FirstOrDefault(); if (match != null) { return(match.Value); } } return(null); }