Skip to content

Commit

Permalink
fix regex mode on db update
Browse files Browse the repository at this point in the history
DoTheEvo committed May 17, 2016
1 parent dc5fbeb commit 8d5d324
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions angrysearch.py
Original file line number Diff line number Diff line change
@@ -405,6 +405,7 @@ def replace_old_db_with_new(self):
p.wait()

con = sqlite3.connect(db_path, check_same_thread=False)
con.create_function("regexp", 2, regexp)

def time_difference(self, nseconds):
mins, secs = divmod(nseconds, 60)
@@ -1648,6 +1649,7 @@ def open_database():
return sqlite3.connect(temp, check_same_thread=False)


# CUSTOM REGEX FUNCTION FOR SQLITE TO ALLOW REGEX SEARCH MODE
def regexp(expr, item):
name = item.split('/')[-1]
r = re.compile(expr, re.IGNORECASE)

0 comments on commit 8d5d324

Please sign in to comment.