This commit is contained in:
Markos Gogoulos
2026-01-09 13:29:18 +02:00
parent fdfa857794
commit 4bd56da2d8
10 changed files with 177 additions and 25 deletions

View File

@@ -965,3 +965,13 @@ def get_alphanumeric_only(string):
"""
string = "".join([char for char in string if char.isalnum()])
return string.lower()
def get_alphanumeric_and_spaces(string):
"""Returns a query that contains only alphanumeric characters and spaces
This include characters other than the English alphabet too
"""
string = "".join([char for char in string if char.isalnum() or char.isspace()])
# Replace multiple spaces with single space and strip
string = " ".join(string.split())
return string.lower()