diff --git a/ietf/community/forms.py b/ietf/community/forms.py index 1677c950c..f5aabf2ae 100644 --- a/ietf/community/forms.py +++ b/ietf/community/forms.py @@ -4,6 +4,8 @@ from __future__ import absolute_import, print_function, unicode_literals +import re + from django import forms from django.db.models import Q @@ -94,7 +96,12 @@ class SearchRuleForm(forms.ModelForm): f.required = True def clean_text(self): - return self.cleaned_data["text"].strip().lower() # names are always lower case + candidate_text = self.cleaned_data["text"].strip().lower() # names are always lower case + try: + re.compile(candidate_text) + except re.error as e: + raise forms.ValidationError(str(e)) + return candidate_text class SubscriptionForm(forms.ModelForm):