2

I have this regex

\%(\w\|[^[:punct:][:space:]]\|\%(\\\\\)*\\\)\%#\|\%#\%(\w\|[^[:space:][:punct:]]\)

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]

\%([^\Wub]\|[^[:punct:][:space:]]\|\%(\\\\\)*\\\)\%#\|\%#\%([^\Wub]\|[^[:space:][:punct:]]\)

But somehow in this line new regex matches e character.

name=decode_header(file_name_info)[0][0].replace(),
                                               ^

And old one doesn't.

5

\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, privacy policy and cookie policy

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