@@ -170,12 +170,12 @@ htmlPattern
170
170
171
171
**type **: ``string|Boolean `` **default **: null
172
172
173
- This option specifies the pattern to use in the html5 ``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 the HTML5 ``pattern `` attribute.
174
+ You usually don't need to specify this option because by default, the constraint
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]+ ``).
177
177
178
- However, their are some other incompatibilities between both patterns which
178
+ However, there are some other incompatibilities between both patterns which
179
179
cannot be fixed by the constraint. For instance, the html5 pattern attribute
180
180
does not support flags. If you have a pattern like ``/[a-z]+/i `` you need to
181
181
specify the html5 compatible pattern in the ``htmlPattern `` option:
@@ -213,14 +213,20 @@ specify the html5 compatible pattern in the ``htmlPattern`` option:
213
213
.. code-block :: xml
214
214
215
215
<!-- 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 >
224
230
225
231
.. code-block :: php
226
232
0 commit comments