NB. I only want to know if it\'s a valid application of unescaped hyphen in the regex definition. It\'s not a question about matching email
Hyphens inside character class are used for range. However, when put at the beginning or at the end inside character class there is no need of escaping that.
Note that, in some browsers, hyphens at any position in the character class are still considered as range metacharacters, so it is best practice to always escape it.
Quoting from regular-expressions.info
The hyphen can be included right after the opening bracket, or right before the closing bracket, or right after the negating caret. Both
[-x]
and[x-]
match anx
or a hyphen.[^-x]
and[^x-]
match any character that is not anx
or a hyphen. Hyphens at other positions in character classes where they can't form a range may be interpreted as literals or as errors. Regex flavors are quite inconsistent about this.