title: Django alpha numeric validation in form fields
body: <p>I want to perform  a field validation,but the conditions are</p>
  
  <p>1)The field should have 10 character.</p>
  
  <p>2)off these 1st 5 character should be alphabets and next 5 character should be numeric digits</p>
  
  <p>I performed validation for maximum length check,but rest of the thing how to perform.Is that can be done on a single "if" condition.</p>
  
  <p>I am searching for the logic in google for performing that,but not got any idea.Can any one help me to perform the same.</p>
  
  <p>forms.py for length check</p>
  
  <pre><code>def clean_bookref(self):
          cd=self.cleaned_data
          bookref=cd.get('bookref')
  
          if len(bookref)&lt;10 and re.match(r'[A-z0-9]+', bookref):
              raise forms.ValidationError("Should be 10 digits")
  
          return bookref
  </code></pre>
  
  <p>I am using this code to do but it is not working.</p>
  
  <p>Thanks  </p>