Click to See Complete Forum and Search --> : Regular expression for content filtering e-mail message attachments


SuSEMac-97008
10-16-2001, 02:01 PM
I am slowly (very) trying to learn regular expressions. I work with an e-mail content filter and I need to come up with a regex that will block messages that have an attachment with double file extensions, i.e. 'test.txt.vbs'. I can create content filters that block messages with attachments with a text to match field that reads: "filename=+.\.ext"

If anyone has suggestions for a similar string that would allow me block double extension file attchements, I would appreciate it.

YaRness
10-16-2001, 04:33 PM
here's a perl matching expression

/(\.[^\.]{3}){2}$/
this will match any .xxx.yyy, but only if both extensions are 3 letters. it could be easily adjusted to account for 1 and two letter extensions.

i haven't tested it so be wary.