You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 006af0b
Browse filesBrowse the repository at this point in the historyBrowse files
Previously, there was no documentation of what `Validators.email()`
expects as a valid e-mail address, making it difficult for people to
determine whether it covers their requirements or not. Even more so that
the used pattern slightly deviates from the
[WHATWG version](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address).
One's only option was to look at the source code and try to decipher the
regexp pattern.
This commit adds a high-level description of the validator and mentions
its similarity to and differences from the WHATWG version. It also adds
a brief explanation of the regexp's behavior and references for more
information in the source code to provide more context to
maintainers/users trying to understand the implementation in the future.
Fixes#18985Fixes#25186Closes#32747
PR Close#32961
* [WHATWG version](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with
82
+
* some enhancements to incorporate more RFC rules (such as rules related to domain names and the
83
+
* lengths of different parts of the address). The main differences from the WHATWG version are:
84
+
* - Disallow `local-part` to begin or end with a period (`.`).
85
+
* - Disallow `local-part` length to exceed 64 characters.
86
+
* - Disallow total address length to exceed 254 characters.
87
+
*
88
+
* See [this commit](https://github.com/angular/angular.js/commit/f3f5cf72e) for more details.
* Validator that requires the control's value pass an email validation test.
193
223
*
224
+
* Tests the value using a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
225
+
* pattern suitable for common usecases. The pattern is based on the definition of a valid email
226
+
* address in the [WHATWG HTML specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)
227
+
* with some enhancements to incorporate more RFC rules (such as rules related to domain names and
228
+
* the lengths of different parts of the address).
229
+
*
230
+
* The differences from the WHATWG version include:
231
+
* - Disallow `local-part` (the part before the `@` symbol) to begin or end with a period (`.`).
232
+
* - Disallow `local-part` to be longer than 64 characters.
233
+
* - Disallow the whole address to be longer than 254 characters.
234
+
*
235
+
* If this pattern does not satisfy your business needs, you can use `Validators.pattern()` to
236
+
* validate the value against a different pattern.
237
+
*
194
238
* @usageNotes
195
239
*
196
240
* ### Validate that the field matches a valid email pattern
0 commit comments