Ответ 1
Используйте класс с отрицанием, включая \W или\S.
/[^\W_]/ # anything that not a non-word character and not _
/[^\S\t]/ # anything that not a non-space character and not \t
Скажем, я хочу совместить символ "word" (\w
), но исключить "_" или совместить символ пробела (\s
), но исключить "\ t". Как я могу это сделать?
Используйте класс с отрицанием, включая \W или\S.
/[^\W_]/ # anything that not a non-word character and not _
/[^\S\t]/ # anything that not a non-space character and not \t