A regular expression containing all the special character combinations in vim

With this publication, I can search for words containing combinations of all vowel letters.
regular expression:

(?=\w*a)(?=\w*e)(?=\w*i)(?=\w*o)(?=\w*u)\w+

corresponds to an example:

abstemious
education
reputation
facetious

Then I modify the following vim expression as a regular expression:

\(\ze\w\{-}a\)\(\ze\w\{-}e\)\(\ze\w\{-}i\)\(\ze\w\{-}o\)\(\ze\w\{-}u\)\w\+

changes

( to \(
?= to \ze
* to \{-}
+ to \+

But now it matches only serial occurrences, for example

abstemious 
facetious

not education,reputation

Where did I miss?

+4
source share
1 answer

This vim-regex should help you:

\v(\w{-}a)@=(\w{-}e)@=(\w{-}i)@=(\w{-}o)@=(\w{-}u)@=\w+
  • Presenter \vmeans coincidence in very magic mode, :h magicfor details
  • look in vim regex (...)\@=, :h \@=for details
+7
source

Source: https://habr.com/ru/post/1652993/


All Articles