1

The expression:

/\v(A)@<=b+\1

What

\v

and

@<=

means?

It's sure this is able to find 'bbbA' in "AbbbA'-s. It's trivial that the number n of b-s can be any n > 1.

1

From :help /\v:

Use of "\v" means that in the pattern after it all ASCII characters except '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning.

\v is also called "very magic" mode. By adding \v one may often type regexes with a smaller amount of characters, since one does not need to escape things. As an example, \v(a|b|c) is equivalent to \(a\|b\|c\).

From :help /\@<=:

Matches with zero width if the preceding atom matches just before what follows.

This can often (but not always) be replaced with \zs, which is both faster and easier to type. An example, using \v to reduce the escaping: \v(foo)@<=bar will match any bar in foobar. This is equivalent to foo\zsbar.


The regex /\v(A)@<=b+\1 will match any number of bs followed by an A as long as it is preceded by an A, e.g. A[bA] and A[bbbbbba], where [] denotes the beginning and end of the matched pattern. This specific regex is much better to write as A\zsb\+A, which will be both faster and is easier to type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.