title: symfony form validation clean with regex before validate with regex
body: <p>I'm using Symfony 1.4 and am a little stuck regarding form validation. I have a validator like the one below:</p>
  
  <pre><code>$this-&gt;setValidator('mobile_number', new sfValidatorAnd(array(
      new sfValidatorString(array('max_length' =&gt; 13)),
      new sfValidatorRegex(array('pattern' =&gt; '/^07\d{9}$/'),
      array('invalid' =&gt; 'Invalid mobile number.')),
    )
  ));
  </code></pre>
  
  <p>That is a simple regex for matching a UK mobile phone number.</p>
  
  <p>However my problem is that if someone submitted a string like this: "07  90  44 65 48 1" the regex would fail but they have given a valid number if a the string was cleaned to remove whitespace first.</p>
  
  <p>My problem is that I don't know where within the symfony form framework I would accomplish this.</p>
  
  <p>I need to strip everything but numbers from the user input and then use my mobile_number validator.</p>
  
  <p>Any ideas would be greatly appreciated. Thanks.</p>