A glance at the regular expressions of VIM __ Regular expressions

Source: Internet
Author: User

VIM handles strings with a look around to facilitate complex deletion and replacement operations

For an explanation of the look, please refer to Yurii's "proficient in regular expression" book.

If you have the following string:

Smallcat

Smalldog

Mysmallcat

Smallcat_lili

\@= Order
Eg: find the characters behind the cat small
/small\ (cat\) \@=

\@! Order negative Look around
Eg: find characters that are not followed by cat small
Small\ (cat\) \@.

\@<= Reverse
Eg: Look up the cat in front of the small
\ (small\) \@<=cat

\@<! Reverse negation
Eg: Find Cat in front that is not small

\ (small\) \@<. Cat

\@> Curing Group

\% (atom\) non-capture bracket

This means that this grouping is not captured and does not record the expression within this bracket:

%s/\% (cat\) _\ (lili\)/\1/gc

Reference documentation

http://blog.csdn.net/lxcnn/article/details/4304754http://blog.csdn.net/lxcnn/article/details/4304754

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.