Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

gVIM Windows grouping and backreferencing – E486: Pattern not found

I try to substitute the text:

abc def ghi

and delete the third word:

For this I use:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.s:\(\w+ \w+\) \w+:\1/

following this tutorial: 4.5 Grouping and Backreferences

Unfortunately when I execute this command I get

E486: Pattern not found: \(\w+ \w+\) w+

Any idea what I’m doing wrong?

>Solution :

The Quantifier, +, Needs to be Escaped

Your pattern is fine, it is just that you need to escape your quantifier, +.

You had this:

.s:\(\w+ \w+\) \w+:\1/

Change it to this:

.s:\(\w\+ \w\+\) \w\+:\1/

When in doubt, look it up in Vim’s help files.

:help pattern /notice section 3 covers magic and section 5 covers quantifiers/

Some people like using magic which reduce the amount of escaping. You might want to peruse this.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading