title: Create a custom validation constraint that will check if a word begin with an uppercase - Symfony 2
body: <p>I've followed this tutorial : <a href="http://symfony.com/doc/current/cookbook/validation/custom_constraint.html" rel="nofollow">http://symfony.com/doc/current/cookbook/validation/custom_constraint.html</a> to create a custom validation constraint.
  I made it work, no problem.
  The tutorial explains how to create a constraint that will only allow a user to type alphanumeric characters into a field.
  What I want is to do create a constraint that will force the user to type a string beginning by an uppercase.</p>
  
  <p>I guess I have to change this part of my function :</p>
  
  <pre><code>public function validate($value, Constraint $constraint)
  {
      if (!preg_match('/^[a-zA-Za0-9]+$/', $value, $matches)) {
          $this-&gt;context-&gt;addViolation($constraint-&gt;message, array('%string%' =&gt; $value));
      }
  </code></pre>
  
  <p>But I'm too new in php, and I don't know the syntax of the constraint I want.</p>