Emacs里用正则表达式匹配中文
这是个非常好用的功能 也是其他正则表达式里面不具备或不能优雅实现的(比如有些地方用[\u4e00-\u9fa5]
来匹配中文 你觉得你能记住么)
但就这个方便的功能我也记不住 而且手册也看不大懂
正确写法:
Emacs里正则匹配中文的写法是\cc
手册里面是这么说的
‘\cC’
matches any character that belongs to the category C. For example,
‘\cc’ matches Chinese characters, ‘\cg’ matches Greek characters,
etc. For the description of the known categories, type ‘M-x
describe-categories RET’.‘\CC’
matches any character that does not belong to category C.