aid*_*dan 36 regex unicode vim
我是个白痴.
有人将微软单词中的一些文字剪切并粘贴到我可爱的html文件中.
我现在有这些unicode字符而不是常规引号符号(即引号在文本中显示为<92>)
我想做一个正则表达式替换,但我在选择它们时遇到了麻烦.
:%s/\u92/'/g
:%s/\u5C/'/g
:%s/\x92/'/g
:%s/\x5C/'/g
Run Code Online (Sandbox Code Playgroud)
......都失败了.我的google-fu让我失望了.
mic*_*ael 66
从:help regexp
(轻微编辑),你需要使用一些特定的语法来选择在Vim中使用正则表达式的unicode字符:
\%u match specified multibyte character (eg \%u20ac)
Run Code Online (Sandbox Code Playgroud)
也就是说,要使用十六进制代码20AC搜索unicode字符,请在搜索模式中输入:
\%u20ac
Run Code Online (Sandbox Code Playgroud)
完整的字符搜索模式表包括一些其他选项:
\%d match specified decimal character (eg \%d123)
\%x match specified hex character (eg \%x2a)
\%o match specified octal character (eg \%o040)
\%u match specified multibyte character (eg \%u20ac)
\%U match specified large multibyte character (eg \%U12345678)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16727 次 |
最近记录: |