Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e27db9

Browse files
committed
[symfony#2864] Small tweaks thanks to@xabbuh on new Regex:htmlPattern option docs
1 parentbd0dc8b commit5e27db9

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

‎reference/constraints/Regex.rst‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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 inthe``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 areremoved (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
179179
cannot be fixed by the constraint. For instance, the html5 pattern attribute
180180
does not support flags. If you have a pattern like ``/[a-z]+/i`` you need to
181181
specify 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-
<classname="Acme\BlogBundle\Entity\Author">
217-
<propertyname="name">
218-
<constraintname="Regex">
219-
<optionname="pattern">/^[a-z]+$/i</option>
220-
<optionname="htmlPattern">^[a-zA-Z]+$</option>
221-
</constraint>
222-
</property>
223-
</class>
216+
<?xml version="1.0" encoding="UTF-8" ?>
217+
<constraint-mappingxmlns="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+
<classname="Acme\BlogBundle\Entity\Author">
222+
<propertyname="name">
223+
<constraintname="Regex">
224+
<optionname="pattern">/^[a-z]+$/i</option>
225+
<optionname="htmlPattern">^[a-zA-Z]+$</option>
226+
</constraint>
227+
</property>
228+
</class>
229+
</constraint-mapping>
224230
225231
..code-block::php
226232

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp