title: Symfony2 autogenerated HTML5 constraints does not work
body: <p>I'm trying to create a form with Symfony2 (v2.3.6) and take advantage of the autogenerated HTML5 constraints.</p>
  
  <p>So, I created a very simple form with just one field with a <code>RegEx</code> constraint:</p>
  
  <pre><code>public function formAction()
  {
      $form = $this-&gt;createFormBuilder()-&gt;add('animalName', 'text', array(
          'constraints' =&gt; new \Symfony\Component\Validator\Constraints\Regex('/(cat|dog)/')
      ))-&gt;getForm();
  
      if ($this-&gt;getRequest()-&gt;isMethod('POST')) {
          $form-&gt;bind($this-&gt;getRequest());
      }
  
      return $this-&gt;render('MeTestBundle:Default:form.html.twig', array('form' =&gt; $form-&gt;createView()));
  }
  </code></pre>
  
  <p>And, in Twig, nothing out of the ordinary.</p>
  
  <pre><code>{% extends "::base.html.twig" %}
  
  {% block body %}
      {{ form(form) }}
  {% endblock %}
  </code></pre>
  
  <p>Well, as a final result, I was expecting <code>animalName</code> field to has a <code>pattern</code> attribute with value <code>(cat|dog)</code>. As it says in <a href="http://symfony.com/doc/current/reference/constraints/Regex.html#htmlpattern" rel="nofollow">this link</a>, Symfony would generate the <code>htmlPattern</code> of this constraint (I tested it, it returns <code>.*(cat|dog).*</code>, which is ok), and this attribute would be used on client side validation by using <code>pattern</code> HTML attribute on the <code>input</code> element. But there is no <code>pattern</code> attribute, the generated code is as follows:</p>
  
  <pre><code>&lt;input type="text" id="form_animalName" name="form[animalName]" required="required" /&gt;
  </code></pre>
  
  <p>After a little research, I think that the responsible of guess the value of <code>pattern</code> attribute is <code>Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser</code>, but this service is never initialized (I wrote a <code>die</code> in it constructor and also forced the container to get the service to check if <code>die</code> is reached).</p>
  
  <p>Am I missing something?</p>