title: Using Django's RegexValidator outside of models
body: <p>I defined a regex validator using Django's built in library. I use it to validate my fields on my models. Like this:</p>
  
  <pre><code>from django.core.validators import RegexValidator
  
  validate_alphanumeric = RegexValidator(r'^[a-zA-Z0-9]*$', 'Only alphanumeric characters are allowed.')
  
  class MyModel(models.Model):
      label = models.CharField(max_length=40, validators=[validate_alphanumeric])
  </code></pre>
  
  <p>However, how can I use it outside of my fields? Like lets say I want to validate the string <code>'Hello'</code> using the validator, provided the validator is stored in a regular variable, instead of a model. The docs seemed pretty confusing.</p>
  
  <p>Thanks.</p>