Some problems with regularization js?

match `~! @-sharp$% ^ & * () _ +-= [] {} |;: ",. / < >? these special symbols, how to write regular, always report errors. I don"t know what needs to be escaped

.

wrap them together in square brackets, and then escape a set of square brackets in the outermost square brackets with a backslash

/[`~!@-sharp$%^&*()_+-=\[\]{}|;:'",./<>?]/

symbols are escaped, and then you can match the items that are allowed to be entered.


reference: Chinese third edition of javascript Advanced programming, P103

Menu