Konrad
Konrad

Reputation: 18595

Exclude words with numbers from spellcheck in vim

Following a similar answer I would like to ignore words with numbers that are of the following format:

AB12
AB2
CD98
..

this is achieved with use of the following regex:

[A-Z]{2}\d{1,}

(regex101)

The syntax I'm trying:

:syn match ignoredCapitalWords +[A-Z]{2}\d{1,}+ contains=@NoSpell

does not seem to be generating the desired results as the words remain marked as potentially misspelled:

wrong misspelling highlight

How can I correctly used the previously generated regex to exclude the desired patterns from regex?

Upvotes: 2

Views: 271

Answers (1)

Evgeniy
Evgeniy

Reputation: 806

Php regex engine is not vim regex engine. When you doubt your syntax pattern is right just create a new buffer with desired contents and then use / command. The given pattern throws an error, you just have to escape each { character with backslash. So, the correct pattern is: [A-Z]\{2}\d\{1,}. Never used @NoSpell but the pattern works.

Upvotes: 2

Related Questions