youtube.com/watch?v=cNbcRXKsXf…
OMG!! This one contains so much interesting information about vim and regex stuff 😮 Super interesting... also the problem itself that gets solved is a nice one!! 😺
VIM - I DIDNT KNOW THIS!!! | Prime Reacts
Recorded live on twitch, GET IN https://twitch.tv/ThePrimeagenBecome a backend engineer. Its my favorite sitehttps://boot.dev/?promo=PRIMEYTThis is also the...YouTube
This entry was edited (1 year ago)

Füsilier Breitlinger
in reply to Rebeka Catalina • • •Instead of all that crazy macro stuff, you can just use a regex:
Which is admittedly unreadable, so here it is with some extra formatting/comments:
In essence, we can use
\(.\)followed by\1\@!.to say "match some character" followed by "some character that is different from the first one".We use this to match the first character and ensure that the three next characters are different from the first one:
The
xxxcheck is in a look-ahead group, so it doesn't advance the overall match position, which means we can now check against the second character:The same thing repeats for the third character:
And the last character can just be matched by
.because we've ensured that it is not equal to any of the first three.