Print Page | Close Window

Regex case sensitivity broken

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=3386
Printed Date: 22 December 2024 at 12:46am


Topic: Regex case sensitivity broken
Posted By: Guests
Subject: Regex case sensitivity broken
Date Posted: 06 April 2004 at 10:10pm

On version 1.2.0.212 the following regex will not match the text "Subject":

(Subject)

But this will match:

((?i)Subject)

If there is a capital letter in the regex, (?i) must be used to detect even an exact match in the text.  If the regex is in all lowercase, it will match regardless of the case of the text even without (?i).  If case sensitivity is explicitly turned on with (?-i) and the regex is in uppercase, it will not detect even an exact match in the text:

((?-i)SUBJECT)

does not match "SUBJECT" in the text.

I hope I'm making sense...

Thanks

 




Replies:
Posted By: Guests
Date Posted: 13 April 2004 at 4:30am
(?i) Turn on case insensitivity for the remainder of the regular expression. (Older regex flavors may turn it on for the entire regex.)

 

Hi

I think you got it backwards, (?i) makes in case INsensitiv...

But I see your point I tested:

Subject will not find Subject

subject will find Subject

((?i)subject) will fine Subject also... etc



Posted By: Guests
Date Posted: 13 April 2004 at 6:36pm

You can prefix any of the modifiers with a - to do the opposite, so (?i) makes it case insensitive and (?-i) makes it case sensitive.

 




Print Page | Close Window