Improve Message Id regex
This commit is contained in:
parent
463f4ce22d
commit
edc6d38def
@ -117,7 +117,10 @@ Public Class ImportZUGFeRDFiles
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function GetMessageIdFromFileName(Filename As String) As String
|
Private Function GetMessageIdFromFileName(Filename As String) As String
|
||||||
Dim oMatch = Regex.Match(Filename, "([\w\d]+)~.+", RegexOptions.IgnoreCase)
|
' Regex to find MessageId
|
||||||
|
' See also: https://stackoverflow.com/questions/3968500/regex-to-validate-a-message-id-as-per-rfc2822
|
||||||
|
Dim oRegex = "(((([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(""(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*""))@(([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\]))))~.+"
|
||||||
|
Dim oMatch = Regex.Match(Filename, oRegex, RegexOptions.IgnoreCase)
|
||||||
|
|
||||||
If oMatch.Success Then
|
If oMatch.Success Then
|
||||||
Dim oMessageId = oMatch.Groups(1).Value
|
Dim oMessageId = oMatch.Groups(1).Value
|
||||||
@ -206,6 +209,11 @@ Public Class ImportZUGFeRDFiles
|
|||||||
oMissingProperties = New List(Of String)
|
oMissingProperties = New List(Of String)
|
||||||
oCurrentFileCount += 1
|
oCurrentFileCount += 1
|
||||||
|
|
||||||
|
If Not oFile.Name.EndsWith(".pdf") Then
|
||||||
|
_logger.Debug("Skipping non-pdf file {0}", oFile.Name)
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
|
||||||
_logger.Info("Start processing file {0}", oFile.Name)
|
_logger.Info("Start processing file {0}", oFile.Name)
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user