title: Why does the regex in validation.yml not work in Symfony2?
body: <p>The following configuration in <code>validation.yml</code> is supposed to validate the url field with the given regex as shown in the Symfony docs (<a href="http://symfony.com/doc/2.0/reference/constraints/Regex.html#basic-usage" rel="nofollow">Basic Usage</a>).</p>
  
  <pre><code>MyCompany\MyBundle\Entity\Example:
      properties:
          url:
              - Regex:
                  pattern: "/^(https?:\/\/)?((w{3}\.)?)example.com\/.*/"
                  message: "Must be a valid example.com URL"
  </code></pre>
  
  <p>But an error occurs, instead.</p>
  
  <blockquote>
    <p>Warning: preg_match() [function.preg-match]: Unknown modifier '/' ...</p>
  </blockquote>
  
  <p>Removing occurrences of "/" made it work, but then it isn't the regex I need.</p>
  
  <pre><code>MyCompany\MyBundle\Entity\Example:
          properties:
              url:
                  - Regex:
                      pattern: "/^(https?:)?((w{3}\.)?)example.com.*/"
                      message: "Must be a valid example.com URL"
  </code></pre>
  
  <p>What could the problem be?</p>