I'm trying to use the vim-syntax to configure some custom highlight for my c++ project.
I've created a file named cpp.vim and put it into ~/.vim/syntax/. And to highlight the function name, I put
syn match    cCustomParen    "?=(" contains=cParen,cCppParen
syn match    cCustomFunc     "\w\+\s*(\@=" contains=cCustomParen
hi CustomFunc guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=lightyellow ctermbg=NONE cterm=bold    
hi def link cCustomFunc CustomFunc
into the file cpp.vim, it works as expected.
Now I'm trying to highlight the class name.
Here is what I've tried:
hi CustomClassName guifg=NONE guibg=NONE guisp=NONE gui=bold ctermfg=lightyellow ctermbg=NONE cterm=bold
syn match cCustomClassName "(?<=^class\s)\w\+"
hi def link cCustomClassName CustomClassName
However, the class name is still white.
(?<=^class\s)\w\+ is trying to match a word, which is following a class and a space. For example, this regex can match things like class Test ignoring class, which is exactly what regular expression lookbehind should do.
I've tested this regex with some online tool and it works perfectly. So I don't know why it can not work for the vim syntax config.