You need to escape the . and -
return this.optional(element) || /^[a-zA-Z0-9\._\-]{3,16}$/i.test(value);
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
What does this.optional(element) do ? If this returns true, then the regex is not validated, because of the || (or).
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
That is not correct. Those characters are used as themselves in that character class.
My bad, you're right.
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Can no longer open your pages... I'll try again tonight.
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875