I need a regexfield in django form to accept only letters and numbers, and nothing more. I tried this, but this did not work:
myfield = forms.RegexField(label=("My Label"), max_length=31, regex=r'[a-zA-Z0-9]',
error_message = ("This value must contain only letters and numbers."),
I don't use regular expressions very well. Can you tell me what I'm doing wrong here and how to fix it?
source
share