console.log(/^[0-9a-zA-Z]+[~!@#$%^&*_+-=]+$/.test("123456"));
I think it should return false because the string doesn't end with a character ~!@#$%^&*_+-= but it does return true when it starts. Why is he returning true ?
false
~!@#$%^&*_+-=
true
The problem is that +-= is a range. If you look at the table of the ASCII , you will see that +-= include + , - , . , / , : , ; , < , = and all the numbers 0 .. 9 .
+-=
+
-
.
/
:
;
<
=
0
9
You want to [~!@#$%^&*_+\-=] ( get out of - ).
[~!@#$%^&*_+\-=]