5
5
6
6
The ``Slug `` constraint was introduced in Symfony 7.3.
7
7
8
- Validates that a value is a slug.
9
- A slug is a string that, by default, matches the regex ``/^[a-z0-9]+(?:-[a-z0-9]+)*$/ ``.
8
+ Validates that a value is a slug. By default, a slug is a string that matches
9
+ the following regular expression: ``/^[a-z0-9]+(?:-[a-z0-9]+)*$/ ``.
10
10
11
11
.. include :: /reference/constraints/_empty-values-are-valid.rst.inc
12
12
@@ -19,7 +19,7 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\SlugValidator`
19
19
Basic Usage
20
20
-----------
21
21
22
- The ``Slug `` constraint can be applied to a property or a " getter" method:
22
+ The ``Slug `` constraint can be applied to a property or a getter method:
23
23
24
24
.. configuration-block ::
25
25
@@ -77,14 +77,14 @@ The ``Slug`` constraint can be applied to a property or a "getter" method:
77
77
}
78
78
}
79
79
80
- Examples of valid values :
80
+ Examples of valid values:
81
81
82
82
* foobar
83
83
* foo-bar
84
84
* foo123
85
85
* foo-123bar
86
86
87
- Upper case characters would result in an violation of this constraint.
87
+ Uppercase characters would result in an violation of this constraint.
88
88
89
89
Options
90
90
-------
@@ -94,8 +94,8 @@ Options
94
94
95
95
**type **: ``string `` default: ``/^[a-z0-9]+(?:-[a-z0-9]+)*$/ ``
96
96
97
- This option allows you to modify the regular expression pattern that the input will be matched against
98
- via the :phpfunction: `preg_match ` PHP function.
97
+ This option allows you to modify the regular expression pattern that the input
98
+ will be matched against via the :phpfunction: `preg_match ` PHP function.
99
99
100
100
If you need to use it, you might also want to take a look at the :doc: `Regex constraint <Regex >`.
101
101
0 commit comments