I have this regex


What I wanted to is where this regex matches word characters \w match word characters except u and b so I've changed all \w to [^\Wub]


But somehow in this line new regex matches e character.


And old one doesn't.

1 Answer 1


\W isn't understood as a character class inside a collection, so [^\Wub] is specifying

Match any character other than \, W, u, and b.

See :help /[ for the specifics about what can be used inside a collection.

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.