Print Page | Close Window

RegEx to catch attachments with multiple extensions.

Printed From: LogSat Software
Category: Spam Filter ISP
Forum Name: Spam Filter ISP Support
Forum Description: General support for Spam Filter ISP
URL: https://www.logsat.com/spamfilter/forums/forum_posts.asp?TID=3057
Printed Date: 10 December 2025 at 10:39am


Topic: RegEx to catch attachments with multiple extensions.
Posted By: Guests
Subject: RegEx to catch attachments with multiple extensions.
Date Posted: 03 March 2004 at 3:46pm

Hello,

I am trying to create a regex that would catch attachments with multiple extensions, ie file.zip.html. I have tried (.*?[.]{1})(.*?[.]{1}) and it works in the RegEx Test tab but in production I recieve errors in the log like:

String matching error for (GCRNekit.pdf --and-- (.*?[.]{1})(.*?[.]{1})) : TRegExpr(comp): ParseReg Unmatched () (pos 10)

Any RegEx gurus have a suggestions?

Thanks

LAnce




Replies:
Posted By: Desperado
Date Posted: 03 March 2004 at 4:05pm

Lance,

(.*?[.]{1})(.*?[.]{1})  should be inserted in the GUI as ((.*?[.]{1})(.*?[.]{1})) .  The entire expression must ALLWAYS be inside a () pair but the () pair is not required by the RegEx test in the application.  I did not test to see if the expression works however.

Dan S.



Posted By: Guests
Date Posted: 04 March 2004 at 12:57pm
Won't this also catch  web address http://www.whatever.com" CLASS="ASPForums" TITLE="WARNING: URL created by poster. - http://www.whatever.com" CLASS="ASPForums" TITLE="WARNING: URL created by poster. - http://www.whatever.com ? I am trying to learn about RegEx.  Thanks


Posted By: Desperado
Date Posted: 04 March 2004 at 6:32pm

Yes it will.  I was not looking at the actual expression ... just the error.  I have not even taken a look at what is needed to do what was intended.  I was just trying to make sure that it is known that any expression needs to be inside a "()" pair.

Regards,

Dan S.



Posted By: Desperado
Date Posted: 04 March 2004 at 6:35pm

Hey ... but if the expression above is only looking at "Attachments" then it will block multi extensions and the fact that it will block a web URL doesn't matter because we are only looking at the attachment firld.

Dan S.




Print Page | Close Window