Is there any way to force a particular (RegExp) filter to be case-sensitive? I want to have
/[a-z]A[Dd]\d/
That is, I want it to look for any lower-case letter, then either, then the word "Ad" with a capital "A", then a number. As it is, it'll match things like "read2.gif". I tried
/(?-1)[a-z]A[Dd]\d/
but it didn't work.
Forcing case sensitivity
Two problems with that: first, you can't add tags that way here, since if the concluding character isn't a slash, it won't be recognized as RegEx. Second, why would making it a global search have any impact on case sensitivity?kustodian wrote:Try adding 'g' at the end of the expressions like this:
/[a-z]A[Dd]\d/g
or
/(?-1)[a-z]A[Dd]\d/g
I didn't try if they work, but it should work.
Good pointZzedar wrote:Two problems with that: first, you can't add tags that way here, since if the concluding character isn't a slash, it won't be recognized as RegEx. Second, why would making it a global search have any impact on case sensitivity?

I forgot that RegEx is case sensitive by default (but not in ABP)

Okay, here's what (I think) I've figured out:
The problem is from adblockplus.jar/content/prefs.jsThis applies the "i" flag to the regex when converting it into the form used by Adblock, making it case-insensitive. What makes me nervous about this is this statement from the Core Reference:
The problem is from adblockplus.jar/content/prefs.js
Code: Select all
regexp = new RegExp(regexp, "i");
if (hash.has(regexp))
return;
This seems to indicate that I can't use modifiers in the expression itself to override that "i". I suppose I could change the line to remove that "i", but I don't want to mess with the code since I don't really know much about how it works.The value of ignoreCase is true if the "i" flag was used; otherwise, false. The "i" flag indicates that case should be ignored while attempting a match in a string.
You cannot change this property directly.