如何搜索/替换特殊字符? [英] How to search/replace special chars?
本文介绍了如何搜索/替换特殊字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从维基百科复制粘贴到 Vim 后,我得到了这个:
1 A23 [+] Métier agricole<200e>– 44 P • 2 C4 [×] Métier de l'ameublement<200e>– 10 P5 [×] Métier de l'animation<200e>– 5 人6 [+] Métier en rapport avec l'art<200e>– 11 人 • 4 人7 [×] Métier en rapport avec l'automobile<200e>– 10 P8 [×] Métier de l'aéronautique<200e>– 15 人
问题在于 <200e>
只是一个字符.
我想知道如何将其放入搜索/替换中(通过 /
或 :
强>).
解决方案
查看\%u
的帮助:
这些是您可以使用的序列.看起来你有两个字节,所以 \%u200e
应该匹配.总之,挺奇怪的.UTF-8/ASCII 中的 20 是空格字符,0e 是 ^N.检查您的编码设置.
After a copy-paste from Wikipedia into Vim, I get this:
1 A
2
3 [+] Métier agricole<200e> – 44 P • 2 C
4 [×] Métier de l'ameublement<200e> – 10 P
5 [×] Métier de l'animation<200e> – 5 P
6 [+] Métier en rapport avec l'art<200e> – 11 P • 4 C
7 [×] Métier en rapport avec l'automobile<200e> – 10 P
8 [×] Métier de l'aéronautique<200e> – 15 P
The problem is that <200e>
is only a char.
I'd like to know how to put it in a search/replace (via the /
or :
).
解决方案
Check the help for \%u
:
/\%d /\%x /\%o /\%u /\%U E678 \%d123 Matches the character specified with a decimal number. Must be followed by a non-digit. \%o40 Matches the character specified with an octal number up to 0377. Numbers below 040 must be followed by a non-octal digit or a non-digit. \%x2a Matches the character specified with up to two hexadecimal characters. \%u20AC Matches the character specified with up to four hexadecimal characters. \%U1234abcd Matches the character specified with up to eight hexadecimal characters.
These are sequences you can use. Looks like you have two bytes, so \%u200e
should match it. Anyway, it's pretty strange. 20 in UTF-8 / ASCII is the space
character, and 0e is ^N. Check your encoding settings.
这篇关于如何搜索/替换特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文