Best of VIM tips-serialization 5 Lookup (d)

Source: Internet
Author: User

[Translation]

"/Zs and/ze RegEx delimiters: H // Zs

"/ZsAnd/zeRegular Expression Symbol: H // Zs

/</Zs [^>] */ze>: Search for tag contents, ignoring chevrons

Search XMLMarked content, ignore angle brackets

[Annotation]

: Help // Zs

: Help // ze

This regular expression matches the content between "<>", but does not match the "<" and ">" characters.

"/Zs" indicates that the match starts here, and "/ze" indicates that the match ends here.

 

[Translation]

"Zero-width: H // @ =

"Zero Length: H // @ =

/</@ <= [^>] *>/@ =: Search for tag contents, ignoring chevrons

Search XMLMarked content, ignore angle brackets

/</@ <=/_ [^>] *>/@ =: Search for tags processing SS possible multiple lines

Search for XML that may be crossed by multiple linesMark

[Annotation]

: Help/@ <=

: Help/@ =

These two regular expressions are difficult to understand and cannot be easily explained.

Metacharacters such as "/@ <=", "/@ =", "/<", "/>", "/zs", and "/ze, it does not match any actual characters. They are only used to check whether the matching exists. Regular Expressions must meet the conditions they specify when matching. Because they do not match the actual characters, they are called zero-length metacharacters.

"/<" And "/>" match the start and end of a word.

"/Zs" and "/ze" indicate the start and end of the match.

"/@ <=" Requires that the metacharacters appear just before the matching pattern. It is only used to check this condition. The metacharacter before it is not included in the matching result.

"/@ =" Matches the metacharacter before it, but the matching length is 0. That is to say, it only checks whether the previous metacharacters exist and does not include the previous metacharacters in the matching results. The metacharacters after it are matched at the same position as the metacharacters before it. For example, "foo/(bar/)/@ =" matches Foo in the foolbar word but does not match fool. "Foo/(bar/)/@ = foo" does not match anything, because it requires matching Foo at the beginning of the B Letter of foobar, which is obviously impossible. "Foo/(bar/)/@ = ..." It matches foobar instead of foobbb. Why?

For the regular expression "</@ <= [^>] *>/@ =, "/@ <=" indicates that "<" must appear before the "[^>] *" mode, but the matching starts with "[^>; "/@ =" indicates that ">" must appear, but ">" is not included in the matching result (zero-length matching ). Therefore, the effect of this expression is the same as that of </zs [^>] */ze> above.

: Help // _ []

"/_ []" Matches the metacharacters and linefeeds in the set. We have introduced "/_." and "/_ s" before. They all add line breaks to the original match. This is an extension of the vim regular expression.

 

[Translation]

"Searching over multiple lines/_ means including newline

"Search for multiple rows. /_Contains new rows

/<! --/_ P/{-} -->: Search for multiple line comments

Search for multi-line comments

[Annotation]

: Help/P

: Help/_ p

: Help //{-

This regular expression searches for XML comments across rows.

"/P" indicates that the characters can be displayed. "/_ p" adds line feed Matching Based on "/P.

"/{-}" Matches the previous metacharacters with as few as possible. The difference between it and "*" is that "*" matches as many metacharacters as possible.

 

[Translation]

/Fred/_ S * Joe/I: Any whitespace including newline

Find in FredAnd JoeAny number of spaces between two words, including new lines

[Annotation]

See before.

 

[Translation]

/Bugs/(/_./) * bunny: Bugs followed by bunny anywhere in file

BugsBunny is contained in any locationMultiple rows of a word

[Annotation]

See before.

 

[Translation]

: H /_: Help

Help

[Annotation]

: Help /_

Help portal.

 

[Reference]

1. http://www.rayninfo.co.uk/vimtips.html

2. http://groups.google.com/group/Vim-cn/msg/f72fba0645955101?

3. Vim Help File

4. http://vimcdoc.sourceforge.net/

 

[Note]

This article can be freely used for non-commercial purposes. Indicate the source for reprinting.

Link: http://blog.csdn.net/easwy

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.