1

I am using the latest version of Gvim on Windows 10.

When I type / and some expression, for example /a, I see all matches in the document highlighted.

The documentation says that the asterisk symbol * will match repeated occurrences of the same character, for example, *n will match nnnn.

However, when I type /*n or /\*n, nothing is highlighted, and when I press enter, I receive the message "Pattern not found", even though the word "Connect" is in the document.

When I enter /n*, the entire document is highlighted.

Does this indicate the asterisk has had its meaning remapped due to some Windows configuration or is there some other reason I am not able to match repeated instances of characters? What can I do about this?

1 Answer 1

3
  1. The question is basically about (standard) regex, not Vim.
  2. Quantifier, such as an asterisk, applies to what it follows, not what it precedes, i.e. n*, not *n.
  3. The asterisk means "zero or more". Hence n* matches just anything. It should probably be nn* or n\+ instead.
1
  • Aha. Thank you very much. Commented Sep 10, 2021 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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