Your problem is not *
, it's a hyphen, which represents a range in a character class, in this case all characters are between +
and /
( +,-./
). Invalid range occurs because *
precedes /
.
If you want to include a literal hyphen in a character class, you need to either escape from it, put it at the end, or start:
[^123+/*-]
source share