summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/config/room_directory.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/config/room_directory.py b/synapse/config/room_directory.py
index 41ef3217e8..2ca010afdb 100644
--- a/synapse/config/room_directory.py
+++ b/synapse/config/room_directory.py
@@ -92,10 +92,11 @@ class _AliasRule(object):
             boolean
         """
 
-        if not self._user_id_regex.search(user_id):
+        # Note: The regexes are anchored at both ends
+        if not self._user_id_regex.match(user_id):
             return False
 
-        if not self._alias_regex.search(alias):
+        if not self._alias_regex.match(alias):
             return False
 
         return True