@@ -170,12 +170,12 @@ htmlPattern
170170
171171**type **: ``string|Boolean `` **default **: null
172172
173- This option specifies the pattern to use in thehtml5 ``pattern `` attribute.
174- By default, the constraint will convert the pattern given in the`` pattern ``
175- option into a html5 compatible pattern. This means that the delimeters are
176- removed (e.g. ``/[a-z]+/ `` becomes ``[a-z]+ ``).
173+ This option specifies the pattern to use in theHTML5 ``pattern `` attribute.
174+ You usually don't need to specify this option because by default, theconstraint
175+ will convert the pattern given in the ` pattern `_ option into an HTML5 compatible
176+ pattern. This means that the delimiters are removed (e.g. ``/[a-z]+/ `` becomes ``[a-z]+ ``).
177177
178- However,their are some other incompatibilities between both patterns which
178+ However,there are some other incompatibilities between both patterns which
179179cannot be fixed by the constraint. For instance, the html5 pattern attribute
180180does not support flags. If you have a pattern like ``/[a-z]+/i `` you need to
181181specify the html5 compatible pattern in the ``htmlPattern `` option:
@@ -213,14 +213,20 @@ specify the html5 compatible pattern in the ``htmlPattern`` option:
213213 ..code-block ::xml
214214
215215<!-- src/Acme/BlogBundle/Resources/config/validation.xml-->
216- <class name =" Acme\BlogBundle\Entity\Author" >
217- <property name =" name" >
218- <constraint name =" Regex" >
219- <option name =" pattern" >/^[a-z]+$/i</option >
220- <option name =" htmlPattern" >^[a-zA-Z]+$</option >
221- </constraint >
222- </property >
223- </class >
216+ <?xml version =" 1.0" encoding =" UTF-8" ?>
217+ <constraint-mapping xmlns =" http://symfony.com/schema/dic/constraint-mapping"
218+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
219+ xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
220+
221+ <class name =" Acme\BlogBundle\Entity\Author" >
222+ <property name =" name" >
223+ <constraint name =" Regex" >
224+ <option name =" pattern" >/^[a-z]+$/i</option >
225+ <option name =" htmlPattern" >^[a-zA-Z]+$</option >
226+ </constraint >
227+ </property >
228+ </class >
229+ </constraint-mapping >
224230
225231 ..code-block ::php
226232