private void ParseUsingPDFBox(FileSystemEventArgs e) { try { Thread.Sleep(200); string originalText = ExtractTextFromPdf(e.FullPath); //string re1 = ".*?"; // Non-greedy match on filler string re2 = "((\\d+)(?:[\u4e00-\u9fa5]+))"; // Word 1 string re3 = "(\\s+)"; // White Space 1 string re4 = "(\\d+)"; // Any Single Digit 1 string re5 = "(\\s+)"; // White Space 2 string re6 = "((?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3}))[-:\\/.](?:[0]?[1-9]|[1][012])[-:\\/.](?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])"; // YYYYMMDD 1 string re7 = "( )"; // Any Single Character 1 string re8 = "((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; // HourMinuteSec 1 Regex r = new Regex(/*re1 +*/ re2 + re3 + re4 + re5 + re6 + re7 + re8, RegexOptions.IgnoreCase | RegexOptions.Singleline); Match match1 = r.Match(originalText); //string r1 = ".*?"; // Non-greedy match on filler string r2 = "((?:[\u4e00-\u9fa5]+))"; // Word 1 string r3 = "(\\s+)"; // White Space 1 string r4 = "(\\d+)"; // Any Single Digit 1 string r5 = "(\\s+)"; // White Space 2 string r6 = "((?:[\u4e00-\u9fa5]+))"; // Word 1 string r7 = "(\\s+)"; // White Space 2 string r8 = "((?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3}))[-:\\/.](?:[0]?[1-9]|[1][012])[-:\\/.](?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])"; // YYYYMMDD 1 string r9 = "( )"; // Any Single Character 1 string r10 = "((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; // HourMinuteSec 1 Regex rg = new Regex(r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10, RegexOptions.IgnoreCase | RegexOptions.Singleline); Match match2 = rg.Match(originalText); if (match2.Success && match1.Success) { String deviceName = match1.Groups[1].ToString(); String id = match1.Groups[4].ToString(); string stime = string.Format("{0} {1}", match1.Groups[6].ToString(), match1.Groups[8].ToString()); var startTime = Convert.ToDateTime(stime); string sn = match2.Groups[3].ToString(); var eTime = string.Format("{0} {1}", match2.Groups[7].ToString(), match2.Groups[9].ToString()); var endTime = Convert.ToDateTime(eTime); boilerReportQueue.Push(new BoilerReport(e.FullPath, sn, deviceName, id, startTime, endTime)); } else { LogHelper.GetLogger <PdfMonitorForm>().Debug(string.Format("Parse {0} File Fail", e.FullPath)); } } catch (Exception ex) { } }