Skip to content

Commit

Permalink
Don't use regex for an infix match
Browse files Browse the repository at this point in the history
  • Loading branch information
esoergel committed Oct 8, 2024
1 parent 07644ee commit 08c45c3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions corehq/apps/sms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,7 @@ def chat_contact_list(request, domain):
total_records = len(data)

if sSearch:
safe_search = re.escape(sSearch)
regex = re.compile('^.*%s.*$' % safe_search)
data = [row for row in data if regex.match(row[0]) or regex.match(row[2])]
data = [row for row in data if sSearch in row[0] or sSearch in row[2]]
filtered_records = len(data)

data.sort(key=lambda row: row[0])
Expand Down

0 comments on commit 08c45c3

Please sign in to comment.