On Mon, 12 Jan 2004, Andreas Aardal Hanssen wrote:
>I'll see if changing this behavior will make Mozilla more happy. I can
>provide you with a patch once I've done some debugging.

Here's the patch, see if it helps:

--- src/convert.h.orig  2004-01-12 22:50:50.000000000 +0100
+++ src/convert.h       2004-01-12 22:49:47.000000000 +0100
@@ -239,19 +239,27 @@
   inline std::string toRegex(const std::string &s_in, char delimiter)
   {
     std::string regex = "^";
+
+    char lastChar = '\0';
     for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
       if (*i == '.' || *i == '[' || *i == ']' || *i == '{' || *i == '}' ||
          *i == '(' || *i == ')' || *i == '^' || *i == '$' || *i == '?' ||
          *i == '+' || *i == '\\') {
        regex += "\\";
        regex += *i;
-      } else if (*i == '*')
+      } else if (*i == '*') {
+       if (lastChar == delimiter)
+          regex += "?";
        regex += ".*?";
-       else if (*i == '%') {
+      } else if (*i == '%') {
+        if (lastChar == delimiter)
+          regex += "?";
        regex += "[^\\";
        regex += delimiter;
        regex += "]*?";
       } else regex += *i;
+
+      lastChar = *i;
     }

     if (regex[regex.length() - 1] == '?')

Reply via email to