disable regular expressions for search by default
authorMarius Mauch <genone@gentoo.org>
Sat, 15 Jul 2006 01:27:15 +0000 (01:27 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 15 Jul 2006 01:27:15 +0000 (01:27 -0000)
svn path=/main/trunk/; revision=3876

bin/emerge

index 34b3688d585533f743a61377d147945d22e023ac..4d9c0342f82b36856ed9a447b435385c470b6988 100755 (executable)
@@ -418,16 +418,17 @@ class search:
                        self.matches = {"pkg":[]}
                print "Searching...   ",
 
+               regexsearch = False
+               if self.searchkey[0] == '%':
+                       regexsearch = True
+                       self.searchkey = self.searchkey[1:]
                if self.searchkey[0] == '@':
                        match_category = 1
                        self.searchkey = self.searchkey[1:]
-               if self.searchkey=="*":
-                       #hack for people who aren't regular expression gurus
-                       self.searchkey==".*"
-               if re.search("\+\+", self.searchkey):
-                       #hack for people who aren't regular expression gurus
-                       self.searchkey=re.sub("\+\+","\+\+",self.searchkey)
-               self.searchre=re.compile(self.searchkey.lower(),re.I)
+               if regexsearch:
+                       self.searchre=re.compile(self.searchkey,re.I)
+               else:
+                       self.searchre=re.compile(re.escape(self.searchkey), re.I)
                for package in self.portdb.cp_all():
                        self.spinner.update()