Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在记事本++([\t\s\,])+中,我打算匹配制表符、空格或逗号的模式匹配换行符(\r\n在记事本中)。为什么是这样?
([\t\s\,])+
\r\n
\s代表任何空白字符。它会匹配制表符,但也会匹配新行和回车,因为它们也是空白字符。
\s
如果您只想匹配制表符、空格或逗号,请使用如下模式:
[\t ,]+
\s匹配所有空白字符。
空间匹配空间。
为什么是这样?
因为\s也会匹配空白字符。