Exemplo n.º 1
0
        public Copyright(CopyrightTemplate companyTemplate)
        {
            this.template = companyTemplate;

            if (string.IsNullOrWhiteSpace(template.CompanyPattern))
            {
                template.CompanyPattern = template.Company;
            }

            var companyPattern = "(?'company'" + template.CompanyPattern + ")";

            copyrightName = "© Copyright";
            var spacePattern      = "(\\s*)";
            var singleYearPattern = "(?'singleYear'(19|20)?[0-9][0-9])";
            var beginPattern      = "(?'begin'.*)";
            var endPattern        = "(?'end'.*)";

            yearSpanPattern = $"(?'spanYear'(?'fromYear'{singleYearPattern})-(?'toYear'{singleYearPattern}))";
            yearPattern     = $"(({singleYearPattern}|{yearSpanPattern}),{spacePattern})*(?'endYear'({singleYearPattern}|{yearSpanPattern}))";
            var copyrightPattern = $"(?'copyright'(©|\\([Cc]\\)){spacePattern}(([Cc]opyright|[Cc]opr.))?)";

            multiYearCopyrightPattern = beginPattern + copyrightPattern + spacePattern + yearPattern + spacePattern + companyPattern + endPattern;
        }