38

「単語」文字(\w)と一致させて「_」を除外するか、空白文字(\s)と一致させて「\t」を除外するとします。これどうやってするの?

4

1 に答える 1

61

\Wまたは\Sを含む否定されたクラスを使用します。

/[^\W_]/  # anything that's not a non-word character and not _
/[^\S\t]/ # anything that's not a non-space character and not \t
于 2010-08-23T15:21:10.517 に答える