public ExtractorRegullarExpression GetInstanceOfExtractorRegullarExpression(ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 extractorRegularExpressionArtifactId) { var extractorRegullarExpressionRdo = ArtifactQueries.GetExtractorRegularExpressionRdo(ServicesMgr, identity, workspaceArtifactId, extractorRegularExpressionArtifactId); var regEx = new ExtractorRegullarExpression(ArtifactQueries, workspaceArtifactId, extractorRegullarExpressionRdo, ErrorLogModel); return(regEx); }
private List <ExtractorRegullarExpression> PopulateRegExList() { ExtractorRegullarExpression emailRegEx = new ExtractorRegullarExpression() { Name = "Email", RegularExpression = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", Description = "Matches emails" }; ExtractorRegullarExpression ssnRegEx = new ExtractorRegullarExpression() { Name = "SSN", RegularExpression = @"\b\d{3}-\d{2}-\d{4}\b*", Description = "This regular expression matches SSN" }; ExtractorRegullarExpression usPhoneNumberRegEx = new ExtractorRegullarExpression() { Name = "US Phone Number", RegularExpression = @"(1?)(-| ?)(\()?([0-9]{3})(\)|-| |\)-|\) )?([0-9]{3})(-| )?([0-9]{4}|[0-9]{4})", Description = "This regular expression matches US phone numbers" }; ExtractorRegullarExpression ukPhoneNumberRegEx = new ExtractorRegullarExpression() { Name = "UK Phone Number", RegularExpression = @"(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?", Description = "This regular expression matches UK phone numbers" }; ExtractorRegullarExpression auPhoneNumberRegEx = new ExtractorRegullarExpression() { Name = "AU Phone Number", RegularExpression = @"(\+\d{2}[ \-]{0,1}){0,1}(((\({0,1}[ \-]{0,1})0{0,1}\){0,1}[2|3|7|8]{1}\){0,1}[ \-]*(\d{4}[ \-]{0,1}\d{4}))|(1[ \-]{0,1}(300|800|900|902)[ \-]{0,1}((\d{6})|(\d{3}[ \-]{0,1}\d{3})))|(13[ \-]{0,1}([\d \-]{5})|((\({0,1}[ \-]{0,1})0{0,1}\){0,1}4{1}[\d \-]{8,10})))", Description = "This regular expression matches AU phone numbers" }; ExtractorRegullarExpression dateRegEx1 = new ExtractorRegullarExpression() { Name = "Date Format 1", RegularExpression = @"((0?[13578]|10|12)(-|\/)((0[0-9])|([12])([0-9]?)|(3[01]?))(-|\/)((\d{4})|(\d{2}))|(0?[2469]|11)(-|\/)((0[0-9])|([12])([0-9]?)|(3[0]?))(-|\/)((\d{4}|\d{2})))", Description = "This regular expression matches dates in following formats: XX/XX/YYYY, XX/XX/YY, X/X/YY, XX-XX-YYYY, XX-XX-YY, X-X-YY" }; ExtractorRegullarExpression dateRegEx2 = new ExtractorRegullarExpression() { Name = "Date Format 2", RegularExpression = @"((0?[1-9]|[12][1-9]|3[01])\.(0?[13578]|1[02])\.20[0-9]{2}|(0?[1-9]|[12][1-9]|30)\.(0?[13456789]|1[012])\.20[0-9]{2}|(0?[1-9]|1[1-9]|2[0-8])\.(0?[123456789]|1[012])\.20[0-9]{2}|(0?[1-9]|[12][1-9])\.(0?[123456789]|1[012])\.20(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))", Description = "This regular expression matches dates in the following formats: DD.MM.YYYY, D.M.YYYY" }; ExtractorRegullarExpression ibanRegEx = new ExtractorRegullarExpression() { Name = "IBAN", RegularExpression = @"[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}", Description = "This regular expression matches IBAN" }; ExtractorRegullarExpression creditCardRegEx = new ExtractorRegullarExpression() { Name = "Credit Card", RegularExpression = @"(4\d{12})|(((4|3)\d{3})|(5[1-5]\d{2})|(6011))(-?|\040?)(\d{4}(-?|\040?)){3}|((3[4,7]\d{2})((-?|\040?)\d{6}(-?|\040?)\d{5}))|(3[4,7]\d{2})((-?|\040?)\d{4}(-?|\040?)\d{4}(-?|\040?)\d{3})|(3[4,7]\d{1})(-?|\040?)(\d{4}(-?|\040?)){3}|(30[0-5]\d{1}|(36|38)\d(2))((-?|\040?)\d{4}(-?|\040?)\d{4}(-?|\040?)\d{2})|((2131|1800)|(2014|2149))((-?|\040?)\d{4}(-?|\040?)\d{4}(-?|\040?)\d{3})", Description = "This regular expression matches credit cards" }; List <ExtractorRegullarExpression> regExList = new List <ExtractorRegullarExpression>() { emailRegEx, ssnRegEx, usPhoneNumberRegEx, ukPhoneNumberRegEx, auPhoneNumberRegEx, dateRegEx1, dateRegEx2, ibanRegEx, creditCardRegEx }; return(regExList); }