I always been a little bugged by the case treatment, but I think I'm the
only one :).

Since I've lived and breathed grep/egrep, I can't untrain myself to think
that the search string "(abc|def):" will match abc: or Abc: or DEF: and so
forth.

If not this, I guess my next choice would be the behavior of emacs'
"search-forward", which is case-insensitive only if the expression contains
only lowercase letters.

But as you've discovered, a trick such as prepending 'X?' works fine.

For those interested in the code, the relevant portion is (from pattern.c):

/* if no uppercase letters are given, do a case-insensitive search */
int mutt_which_case (const char *s)
{
  while (*s)
  {
    if (isalpha (*s) && isupper (*s))
      return 0; /* case-sensitive */
    s++;
  }
  return REG_ICASE; /* case-insensitive */
}
 
Here, REG_ICASE has been set to (something > 0) elsewhere, and is used when
calling regcomp to ignore case.

This function may be the way it is due to performance considerations, since
an uppercase letter causes an immediate return.

Reply via email to