python - Django RegexField Letters and Numbers only -


i need regexfield in django form accept letters , numbers, , nothing else. i've tried this, didn't work:

myfield = forms.regexfield(label=("my label"), max_length=31, regex=r'[a-za-z0-9]',         error_message = ("this value must contain letters , numbers."), 

i not @ using regular expressions. can tell me doing wrong here , how fix it?

regex=r'[a-za-z0-9]',

is 1 letter.

do want more 1 letter? use repeat

regex=r'[a-za-z0-9]+',

there numerous tutorials on regular expressions. please google "regular expression tutorial."


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -