File tree 1 file changed +39
-2
lines changed
1 file changed +39
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Regex-Assert-Symfony
2
2
Commun Regex to use with Assert in Symfony's entity
3
3
4
- ## Email
5
-
6
4
## Firstname Lastname City
7
5
Compatible with international names
8
6
@@ -16,7 +14,14 @@ Compatible with international names
16
14
@Assert\Regex(pattern="/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùæúûüųūÿýżźñçÞčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/u")
17
15
```
18
16
17
+ ### Lastname Firstname Examples
18
+
19
+ Mathias d'Arras
20
+ Martin Luther King, Jr.
21
+ Hector Sausage-Hausen
22
+
19
23
### City Examples
24
+
20
25
Toronto
21
26
St. Catharines
22
27
San Fransisco
@@ -35,3 +40,35 @@ Compatible with international names
35
40
Sauðárkrókur
36
41
Þorlákshöfn
37
42
43
+ ## Postal code
44
+ Compatible with international country code
45
+
46
+ ### Pattern
47
+ ```
48
+ /^[0-9 ,.-]+$/
49
+ ```
50
+
51
+ ### Usage
52
+ ```
53
+ @Assert\Regex(pattern="/^[0-9 ,.-]+$/")
54
+ ```
55
+
56
+ ### Examples
57
+
58
+ 1234
59
+ 69001
60
+ 12-3456
61
+ 1234-5678
62
+
63
+ ## Email
64
+ It's recomended to use the string constraints [ Email] ( http://symfony.com/doc/current/reference/constraints/Email.html )
65
+
66
+ ### Usage
67
+ ```
68
+ /**
69
+ * @Assert\Email(
70
+ * message = "The email '{{ value }}' is not a valid email.",
71
+ * checkMX = true
72
+ * )
73
+ */
74
+ ```
You can’t perform that action at this time.
0 commit comments