if (/[~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im.test(subject)) { // Successful match} else { // Match attempt failed}