From c0a38b3d808758f271c432147ca1cbd52bb47209 Mon Sep 17 00:00:00 2001 From: zPlus Date: Tue, 19 Mar 2019 08:10:45 +0100 Subject: [PATCH] Fix database REGEXP function. Use re.search() instead of re.match(). --- freepost/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freepost/database.py b/freepost/database.py index d1c0ef2c..d7133ba7 100644 --- a/freepost/database.py +++ b/freepost/database.py @@ -19,7 +19,7 @@ db.create_function('SHA512', 1, lambda text: # function named "regexp" is added at run-time, then the "X REGEXP Y" operator # will be implemented as a call to "regexp(Y,X)". db.create_function('REGEXP', 2, lambda pattern, string: - re.match(pattern, string, flags=re.IGNORECASE) is not None) + re.search(pattern, string, flags=re.IGNORECASE) is not None) # Store a new session_id for a user that has logged in # The session token is stored in the user cookies during login, here