http://vim.wikia.com/wiki/VimTip188
http://vim.wikia.com/wiki/Search_and_replace
When searching
:
.
, *
, \
, [
, ]
, ^
, and $
are metacharacters.
+
, ?
, |
, {
, }
, (
, and )
must be escaped to use their special function.
\/
is / (use backslash + forward slash to search for forward slash)
\t
is tab, \s
is whitespace
\n
is newline, \r
is CR (carriage return = Ctrl-M = ^M)
\{#\}
is used for repetition. /foo.\{2\}
will match foo and the two following characters. The \
is not required on the closing }
so /foo.\{2}
will do the same thing.
\(foo\)
makes a backreference to foo. Parenthesis without escapes are literally matched. Here the \
is required for the closing \)
.
When replacing
:
\r
is newline, \n
is a null byte (0x00).
\&
is ampersand (& is the text that matches the search pattern).
\1
inserts the text of the first backreference. \2
inserts the second backreference, and so on.
You can use other delimiters
with substitute:
:s#http://www.example.com/index.html#http://example.com/#
Save typing by using \zs
and \ze
to set the start and end of a pattern
. For example, instead of:
:s/Copyright 2007 All Rights Reserved/Copyright 2008 All Rights Reserved/
Use:
:s/Copyright \zs2007\ze All Rights Reserved/2008/
分享到:
相关推荐
HTML转义字符大全:ISO Latin-1字符集,各种字符的转义
常用HTML转义字符,html转义符,JavaScript转义符,html转义字符表,HTML语言特殊字符对照表(ISO Latin-1字符集) - 来源:嘻嘻网 114_xixik_com_files
Python 使用反斜杠 \ 转义特殊字符,如果你不想让反斜杠发生转义,可以在字符串前面添加一个 r,表示原始字符串 print(‘shi\jiazhuang') print(r‘shi\jiazhuang') shi jiazhuang shi\jiazhuang String(字符串) ...
HTML_转义字符 HTML_转义字符
C语言转义字符大全
Python 转义字符逐个详解。一次性全面了解所有转义字符的含义及其用法。
避免gson使用时将一些字符自动转为Unicode转义字符
HTML和XML中的转义字符
C语言常用转义字符表 C语言常用转义字符表
关于转义字符串整理的一些资料,包括转义字符穿的解释、组成信息和转义字符的使用
页面字符转义对照参考 页面字符转义对照参考 页面字符转义对照参考
正则表达 转义字符正则表达 转义字符正则表达 转义字符正则表达 转义字符正则表达 转义字符
C++第4课转义字符
转义字符 ASCII码 转义字符 ASCII码 转义字符 ASCII码 转义字符 ASCII码 转义字符 ASCII码
常见转义字符列表,没有什么技术含量,只是为了记忆方便
本资源系统地介绍了C语言转义字符的原理和应用,包括转义字符的概念、分类、表示、作用等内容,以及如何用转义字符表示ASCII码、控制字符、特殊字符等。本资源适合C语言基础学习者和考生使用,帮助他们深入理解和...
STM32ASCII码表和转义字符 在C 语言中,运算符的优先关系非常重要,如果没有了解其关系,当在一个公式内涉及多个数据的同 时计算,就可能会因为弄错优先关系而导致错误的计算结果。 例如: a | b * c 其中*的优先级...
常用HTML转义字符常用HTML转义字符
ASCII码的转义字符,以及郭天祥十天学会pic单片机的型号,单片机的入门级怎么学好单片机,学精!
使用这三个字符时,应使用它们的转义序列,如下所示: & 或 & & 和 < 或 小于号 > 或 > > 大于号 " " 双引号 空格 © © 版权符 ® ® 注册符 前者为字符转义序列,后者为...