简体   繁体   English

如何在Vim中搜索,使用正则表达式来表示字母(ascii和非ascii)?

[英]How can I search in Vim, using regular expressions for letters (both ascii and non ascii)?

In .NET, \\p{L} matches any ascii or non-ascii letter (so it will match both a and ü ). 在.NET中, \\p{L}匹配任何ascii或非ascii字母(因此它将匹配aü )。

http://www.regular-expressions.info/unicode.html#prop http://www.regular-expressions.info/unicode.html#prop

Is there a Vim equivalent for this? Vim是否相当于此?

In Vim \\a or \\w will only match characters in range [az] (or [0-9A-Za-z_] ). 在Vim \\a\\w只匹配范围[az] (或[0-9A-Za-z_] )中的字符。

You can explicitly tell vim which ranges of hex values to match. 您可以明确告诉vim要匹配的十六进制值范围。 This is kind of a shotgun approach, but if you know what the possible ranges (like UTF-8 for example) this would work: 这是一种猎枪方法,但如果你知道可能的范围(例如UTF-8),这将起作用:

/[\x7f-\xffa-zA-Z]

You can also search for explicit unicode values by entering in the unicode character directly or it's code in the following format: 您还可以通过直接输入unicode字符或以下列格式输入代码来搜索显式unicode值:

/\%u0300

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM