mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
a3482f7076
As mentioned in the previous commit, the regexp used by `Validators.email()` is a slightly enhanced version of the [WHATWG one](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address). This commit refactors the regexp (without changing its behavior) to make it more closely match the format of WHATWG version, so that it is easier for people to compare it against the WHATWG one and understand the differences. The main changes were: - Changing the order of characters/character classes inside `[...]`; e.g. `[A-Za-z]` --> `[a-zA-Z]` - Mark all groups as non-capturing (since we do not use the captured values); e.g. `(foo)` --> `(?:foo)` (This could theoretically also have a positive performance impact, but I suspect JavaScript engines are already optimizing away capturing groups when they are not used.) PR Close #32961