Hello,
I would like to create a filter that alerts us when certain patterns are matched in an outbound message (for example, a social security number in an unencrypted message) for corporate policy enforcement. I don't see any examples in the documentation, Knowledge Base, or forum for doing pattern matching other than a wildcard "*" character, even for a filter pattern file MEFILTER-GENERAL.TXT. All of the examples contain only specific strings to be matched.
One example of the pattern I would like to match is the regular expression [0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9] to detect a social security number.
Is there any way to do this without writing a custom MTA pickup event?
Thanks,
-Tom Rusnock
Pattern matching in filters
-
- Site Admin
- Posts: 9738
- Joined: Mon Mar 22, 2004 4:44 am
- Location: Melbourne, Victoria, Australia
Re: Pattern matching in filters
Hi,
Please find an example below on how to create a scripted filter using regular expressions:
Please be aware that regular expressions will only work using literal values (ie subject, sender, recipients, ipaddress, please review the documentation for a full list) and will not work for Criteriamet items. For Criteriamet items you will need to use wild cards.
Please find an example below on how to create a scripted filter using regular expressions:
Code: Select all
Dim regex
Dim hasmatch
Set regex = New RegExp
With regex
.Pattern = "test"
.IgnoreCase = True
.Global = True
End With
hasmatch = regex.Test("%SUBJECT%")
if hasmatch then
FilterResult=1
else
FilterResult=0
end if
Regards,
Ian Margarone
MailEnable Support
Ian Margarone
MailEnable Support