Print Page | Close Window

Regular Expression Help

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=5442
Printed Date: 14 July 2025 at 4:09pm


Topic: Regular Expression Help
Posted By: Dan B
Subject: Regular Expression Help
Date Posted: 11 January 2006 at 2:48pm

I'm trying to get a RexEx for a following example to email address. I've been using the RegEx Test and having no luck.

Let say I would like to block an address that is mailto:thisname@mydomain.com - thisname@mydomain.com only and not block any other combination with mailto:any_number_of_letters_thisname@mydomain.com - any_number_of_letters_thisname@mydomain.com  including the underscores

I have the following:

((?i)([^\w]+)thisname\@mydomain\.com)

It's not working correctly.  It's doing the opposite.  It's catching mailto:any_number_of_letters_thisname@mydomain.com - any_number_of_letters_thisname@mydomain.com but not just mailto:thisname@mydomain.com - thisname@mydomain.com

If anybody could help that would be great.
Thanks,
Dan B




Replies:
Posted By: Desperado
Date Posted: 12 January 2006 at 10:57am

Dan,

Perhaps I am not understanding the question but ...

((?i)^thisname\@mydomain\.com)



-------------
The Desperado
Dan Seligmann.
Work: http://www.mags.net
Personal: http://www.desperado.com



Posted By: Dan B
Date Posted: 12 January 2006 at 11:32am

Dan S,

This is what I want to happen example.

block
mailto:thisname@mydomain.com - thisname@mydomain.com

do not block anthing else.
mailto:abc_thisname@mydomain.com - abc_thisname@mydomain.com
mailto:def_thisname@mydomain.com - def_thisname@mydomain.com
mailto:123_thisname@mydomain.com - 123_thisname@mydomain.com
mailto:xyz_thisname@mydomain.com - xyz_thisname@mydomain.com
mailto:abcthisname@mydomain.com - abcthisname@mydomain.com

I hope this helps.

Thanks,
Dan B



Posted By: Desperado
Date Posted: 12 January 2006 at 12:43pm

Dan,

The RegEx I posted *should* do that.  At least, it does in my tests.



-------------
The Desperado
Dan Seligmann.
Work: http://www.mags.net
Personal: http://www.desperado.com



Posted By: Dan B
Date Posted: 12 January 2006 at 3:34pm

Dan,

Something is very strange.  I copied and pasted your example and tried it and it didn't work.  I went to lunch and tried it again when I came back and it now works in the test with out changing anything.

Thanks,
Dan B



Posted By: Dan B
Date Posted: 12 January 2006 at 3:46pm

Dan,

I'm having a brain fart today. Can you explain the reason of using the (?i) in front of any RegEx

Thanks,
Dan B

 

 



Posted By: Desperado
Date Posted: 13 January 2006 at 1:53pm

Hmmm ... my perl habit  I makes sure that there is NO case sensitivity in the character search.

Technically,  if your RegEx is written in all lower case, I suppose you wouldn't need it.



-------------
The Desperado
Dan Seligmann.
Work: http://www.mags.net
Personal: http://www.desperado.com




Print Page | Close Window